update cv4pve autosnap role #20
3 changed files with 12 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: create directories
|
- name: Ensure needed directories exist
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/usr/local/bin/cv4pve/"
|
path: "/usr/local/bin/cv4pve/"
|
||||||
state: directory
|
state: directory
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
group: "{{ cv4pve_user_group }}"
|
group: "{{ cv4pve_user_group }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
- name: download archives
|
- name: Download specified version
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "{{ cv4pve_dl_link }}"
|
src: "{{ cv4pve_dl_link }}"
|
||||||
dest: /usr/local/bin/cv4pve/
|
dest: /usr/local/bin/cv4pve/
|
||||||
|
@ -19,12 +19,13 @@
|
||||||
list_files: true
|
list_files: true
|
||||||
register: download
|
register: download
|
||||||
|
|
||||||
- name: move
|
- name: Rename binary
|
||||||
ansible.builtin.command: |
|
ansible.builtin.command: |
|
||||||
mv /usr/local/bin/cv4pve/cv4pve-autosnap /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
|
mv /usr/local/bin/cv4pve/cv4pve-autosnap /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
|
||||||
when: download.changed
|
when: download.changed
|
||||||
|
|
||||||
- name: Capture files to delete
|
# https://stackoverflow.com/questions/20252057/using-ansible-how-would-i-delete-all-items-except-for-a-specified-set-in-a-dire
|
||||||
|
- name: Find old versions
|
||||||
ansible.builtin.find:
|
ansible.builtin.find:
|
||||||
paths: /usr/local/bin/cv4pve
|
paths: /usr/local/bin/cv4pve
|
||||||
file_type: file
|
file_type: file
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
- "cv4pve-autosnap-{{ cv4pve_version }}"
|
- "cv4pve-autosnap-{{ cv4pve_version }}"
|
||||||
register: found_files
|
register: found_files
|
||||||
|
|
||||||
- name: Delete files
|
- name: Ensure old versions are absent
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: template cv4pve.service
|
- name: Ensure service-unit (cv4pve) is templated
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: cv4pve.service.j2
|
src: cv4pve.service.j2
|
||||||
dest: /etc/systemd/system/cv4pve.service
|
dest: /etc/systemd/system/cv4pve.service
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
|
|
||||||
- name: template cv4pve_mail.service
|
- name: Ensure service-unit (mail) is templated
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: cv4pve_mail.service.j2
|
src: cv4pve_mail.service.j2
|
||||||
dest: /etc/systemd/system/cv4pve_mail.service
|
dest: /etc/systemd/system/cv4pve_mail.service
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
|
|
||||||
- name: template cv4pve.timer
|
- name: Ensure service-unit (timer) is templated
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: cv4pve.timer.j2
|
src: cv4pve.timer.j2
|
||||||
dest: /etc/systemd/system/cv4pve.timer
|
dest: /etc/systemd/system/cv4pve.timer
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
|
|
||||||
- name: systemctl start cv4pve.timer
|
- name: Ensure timer is started is templated
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: cv4pve.timer
|
name: cv4pve.timer
|
||||||
state: started
|
state: started
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: ensure group exists
|
- name: Ensure group exists
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
name: "{{ cv4pve_user_group }}"
|
name: "{{ cv4pve_user_group }}"
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
when:
|
when:
|
||||||
- cv4pve_user_group is defined
|
- cv4pve_user_group is defined
|
||||||
|
|
||||||
- name: ensure user exists
|
- name: Ensure user exists
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ cv4pve_user }}"
|
name: "{{ cv4pve_user }}"
|
||||||
|
|
Loading…
Reference in a new issue