upt playbook

This commit is contained in:
jaydee 2023-08-30 10:49:49 +02:00
parent 35bc52f5b3
commit d6fc5b1573

View File

@ -1,6 +1,8 @@
- hosts: containers
name: Stop mailu
ignore_unreachable: false
vars:
arch_name: docker_mailu2_data
tasks:
- name: Start mailu rasp
uri:
@ -60,7 +62,7 @@
- name: Create archive
#ansible.builtin.shell: 'tar -czf /share/Data/dockers.tar.gz /share/docker_data/{mailu2,webhub,ha} --exclude="/ha/backups/*" --exclude="home-assistant.log*"'
ansible.builtin.shell: 'tar -czf /share/Data/dockers-{{ ansible_date_time.date }}.tar.gz /share/docker_data/mailu2 --exclude="/ha/backups/*" --exclude="home-assistant.log*"'
ansible.builtin.shell: 'tar -czf /share/Data/{{ arch_name }}-{{ ansible_date_time.date }}.tar.gz /share/docker_data/mailu2 --exclude="/ha/backups/*" --exclude="home-assistant.log*"'
ignore_errors: yes
when: inventory_hostname in groups['nas']
@ -115,9 +117,9 @@
- 140
- 150
- 132
- name: Copy archive
ansible.builtin.shell: 'scp /share/Data/dockers-{{ ansible_date_time.date }}.tar.gz admin@192.168.77.246:/tmp/'
ansible.builtin.shell: 'scp /share/Data/{{ arch_name }}-{{ ansible_date_time.date }}.tar.gz admin@192.168.77.246:/tmp/'
when: inventory_hostname in groups['nas']
#- name: Unpack archive
@ -128,7 +130,7 @@
- name: Extract
become: yes
ansible.builtin.unarchive:
src: /tmp/dockers-{{ ansible_date_time.date }}.tar.gz
src: /tmp/{{ arch_name }}-{{ ansible_date_time.date }}.tar.gz
dest: /
remote_src: yes
when: inventory_hostname in groups['raspberry']