diff --git a/files/pinnwand.service b/files/pinnwand.service index ee92340..d8f6196 100644 --- a/files/pinnwand.service +++ b/files/pinnwand.service @@ -8,7 +8,7 @@ Type=simple User=pinnwand Group=pinnwand WorkingDirectory=/opt/pinnwand/ -ExecStart=/opt/pinnwand/bin/matterbridge --configuration-path pinnwand.toml +ExecStart=/opt/pinnwand/.local/bin/pinnwand --configuration-path pinnwand.toml Restart=always RestartSec=60 diff --git a/tasks/main.yml b/tasks/main.yml index 1d0ae10..73fbe87 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,62 @@ --- # tasks file for pinnwand +- name: "install {{ item }}" + package: + state: present + name: "{{ item }}" + with_items: + - python39 + - python39-setuptools + - python39-pip + +- name: create pinnwand system user + user: + name: pinnwand + comment: "system user to run pinnwand - do not use" + system: yes + home: "/opt/pinnwand" + create_home: yes + +- name: create/set permissions on /opt/pinnwand static config directory + file: + state: directory + recurse: yes + path: "/opt/pinnwand" + mode: 0755 + owner: pinnwand + group: pinnwand + setype: etc_t + seuser: system_u + +- name: install pinnwand into virtualenv + pip: + name: pinnwand + extra_args: --user + executable: pip3.9 + notify: restart pinnwand + + +- name: install /opt/pinnwand/pinnwand.toml + template: + src: pinnwand.toml + dest: "/opt/pinnwand/pinnwand.toml" + mode: 0640 + owner: pinnwand + group: pinnwand + setype: etc_t + seuser: system_u + notify: restart pinnwand + +- name: add /etc/systemd/system/pinnwand.service (systemd unit file) + copy: + src: pinnwand.service + dest: "/etc/systemd/system/pinnwand.service" + mode: 0644 + seuser: system_u + setype: systemd_unit_file_t + +- name: start/enable pinnwand.service + service: + name: pinnwand + state: started + enabled: yes