homeserver/roles/mgrote_cv4pve_autosnap/tasks/install.yml

42 lines
1 KiB
YAML
Raw Normal View History

2024-04-14 21:21:38 +02:00
---
- name: create directories
ansible.builtin.file:
path: "/usr/local/bin/cv4pve/"
state: directory
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
mode: "0644"
- name: download archives
ansible.builtin.unarchive:
src: "{{ cv4pve_dl_link }}"
dest: /usr/local/bin/cv4pve/
mode: '0775'
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
remote_src: yes
creates: /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
list_files: true
register: download
- name: move
ansible.builtin.command: |
mv /usr/local/bin/cv4pve/cv4pve-autosnap /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
when: download.changed
- name: Capture files to delete
ansible.builtin.find:
paths: /usr/local/bin/cv4pve
file_type: file
use_regex: false
excludes:
- "cv4pve-autosnap-{{ cv4pve_version }}"
register: found_files
- name: Delete files
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ found_files['files'] }}"
...