From 6597532e7a777f6d156e9320054fec76d9d91a8c Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Tue, 7 Dec 2021 14:25:52 -0500 Subject: [PATCH] add backup tasks for gallery --- roles/dokuwiki/tasks/backup.yml | 3 --- roles/gallery/tasks/backup.yml | 16 ++++++++++++++++ roles/gallery/tasks/main.yml | 12 ++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 roles/gallery/tasks/backup.yml diff --git a/roles/dokuwiki/tasks/backup.yml b/roles/dokuwiki/tasks/backup.yml index aa1e02e..f0841ee 100644 --- a/roles/dokuwiki/tasks/backup.yml +++ b/roles/dokuwiki/tasks/backup.yml @@ -1,7 +1,4 @@ --- -- debug: - var: doku_path - - name: make dokuwiki archive community.general.archive: dest: "{{ archive }}" diff --git a/roles/gallery/tasks/backup.yml b/roles/gallery/tasks/backup.yml new file mode 100644 index 0000000..9dd93f5 --- /dev/null +++ b/roles/gallery/tasks/backup.yml @@ -0,0 +1,16 @@ +--- +- name: make gallery archive + community.general.archive: + dest: "{{ archive }}" + path: "{{ album_path }}" + +- name: copy archive to controller + fetch: + src: "{{ archive }}" + dest: "{{ output_dir }}" + flat: yes + +- name: remove remote archive + file: + path: "{{ archive }}" + state: absent diff --git a/roles/gallery/tasks/main.yml b/roles/gallery/tasks/main.yml index 5af6e97..0a395ed 100644 --- a/roles/gallery/tasks/main.yml +++ b/roles/gallery/tasks/main.yml @@ -1,4 +1,7 @@ --- +- debug: + var: ansible_run_tags + - name: install gallery import_tasks: install.yml vars: @@ -9,3 +12,12 @@ web_user: lighttpd web_group: lighttpd proxy_port: 3031 + +- name: backup gallery + when: "'backup' in ansible_run_tags" + import_tasks: backup.yml + tags: backup + vars: + output_dir: /tmp/ + archive: "{{ output_dir }}gallery_backup.tgz" + album_path: /var/www/localhost/htdocs/gallery/instance/images