homeserver/roles/mgrote.cv4pve-autosnap/tasks/main.yml
mg 17f0ca874e cv4pve auf systemd umgestellt (#344)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#344
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
2022-03-28 14:48:31 +02:00

73 lines
1.7 KiB
YAML

---
- name: include user tasks
include_tasks: user.yml
- name: create directories
become: yes
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
loop:
- '/tmp/cv4pve'
- '/usr/local/bin/cv4pve'
- name: download archives
become: yes
ansible.builtin.get_url:
url: "{{ cv4pve_dl_link }}"
dest: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
mode: '0775'
- name: extract archives
become: yes
ansible.builtin.unarchive:
src: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
dest: /usr/local/bin/cv4pve
remote_src: yes
mode: a+x
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
- name: template cv4pve.service
become: yes
ansible.builtin.template:
src: cv4pve.service.j2
dest: /etc/systemd/system/cv4pve.service
owner: root
group: root
mode: 0644
notify:
- systemctl daemon-reload
- name: template cv4pve_mail.service
become: yes
ansible.builtin.template:
src: cv4pve_mail.service.j2
dest: /etc/systemd/system/cv4pve_mail.service
owner: root
group: root
mode: 0644
notify:
- systemctl daemon-reload
- name: template cv4pve.timer
become: yes
ansible.builtin.template:
src: cv4pve.timer.j2
dest: /etc/systemd/system/cv4pve.timer
owner: root
group: root
mode: 0644
notify:
- systemctl daemon-reload
- name: systemctl start cv4pve.timer
become: yes
ansible.builtin.systemd:
name: cv4pve.timer
state: started
enabled: yes