homeserver/roles/mgrote.cv4pve-autosnap/tasks/main.yml

74 lines
1.7 KiB
YAML
Raw Normal View History

2020-08-18 11:57:53 +02:00
---
- name: include user tasks
include_tasks: user.yml
2020-08-18 11:57:53 +02:00
- name: create directories
become: yes
ansible.builtin.file:
2020-08-18 11:57:53 +02:00
path: "{{ item }}"
state: directory
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
2020-08-18 11:57:53 +02:00
loop:
- '/tmp/cv4pve'
- '/usr/local/bin/cv4pve'
- name: download archives
become: yes
ansible.builtin.get_url:
url: "{{ cv4pve_dl_link }}"
2020-08-18 11:57:53 +02:00
dest: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
mode: '0775'
- name: extract archives
2020-08-18 11:57:53 +02:00
become: yes
ansible.builtin.unarchive:
2020-08-18 11:57:53 +02:00
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 }}"
2020-08-18 11:57:53 +02:00
- name: template cv4pve.service
2020-08-18 11:57:53 +02:00
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
2020-08-18 11:57:53 +02:00
- name: template cv4pve_mail.service
2020-08-18 11:57:53 +02:00
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
2020-08-18 11:57:53 +02:00
- name: template cv4pve.timer
become: yes
ansible.builtin.template:
src: cv4pve.timer.j2
dest: /etc/systemd/system/cv4pve.timer
owner: root
group: root
2020-08-18 11:57:53 +02:00
mode: 0644
notify:
- systemctl daemon-reload
- name: systemctl start cv4pve.timer
become: yes
ansible.builtin.systemd:
name: cv4pve.timer
state: started
enabled: yes