diff --git a/tasks/backup_ovh1.yml b/tasks/backup_ovh1.yml index 5293215..8df339f 100755 --- a/tasks/backup_ovh1.yml +++ b/tasks/backup_ovh1.yml @@ -7,6 +7,11 @@ ansible.builtin.include_tasks: "tasks/assert_var_not_empty.yml" with_items: "{{ BACKUP_OVH1_REQUIRED_VARS }}" +- name: Create backup directory + ansible.builtin.file: + path: "{{ WORKDIR }}/backup" + state: directory + - name: Archive volumes ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/{{ item }}.tar.gz -C /mnt/volumes {{ item }}" with_items: "{{ BACKUP_OVH1_VOLUMES }}" @@ -23,6 +28,12 @@ ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/mysql-server_dumps.tar.gz -C /mnt/volumes {{ MySQL_dump.stdout_lines | last }} {{ DBs_dump.stdout_lines | last }}" with_items: "{{ BACKUP_OVH1_VOLUMES }}" +thon3-swiftclient is a requirement of duplicity +- name: Install python3-swiftclient + ansible.builtin.package: + name: python3-swiftclient + state: present + - name: Backup with duplicity ansible.builtin.command: "duplicity --num-retries 3 --full-if-older-than 1M --progress --archive-dir {{ ARCHIVE_DIR }} --name {{ lookup('env','BACKUP_WORKFLOW') }} --allow-source-mismatch '{{ WORKDIR }}/backup' swift://{{ lookup('env','BACKUP_WORKFLOW') }}" environment: "{{ DUPLICITY_ENVIRONMENT }}" diff --git a/tasks/bootstrap.yml b/tasks/bootstrap.yml index 1a5398f..30fb74a 100755 --- a/tasks/bootstrap.yml +++ b/tasks/bootstrap.yml @@ -12,6 +12,11 @@ url: "https://{{ CLOUD_SERVER }}/s/{{ lookup('env','KEY') }}/download?path=%2F&files=secrets.tar.gz.enc" dest: "{{ WORKDIR }}/secrets.tar.gz.enc" +- name: Install openssh-client + ansible.builtin.package: + name: openssh-client + state: present + - name: Create /root/.ssh directory ansible.builtin.file: path: /root/.ssh @@ -94,6 +99,11 @@ dest: "{{ WORKDIR }}/{{ item }}" with_items: "{{ BOOTSTRAP_REPOS }}" +- name: Create backup directory + ansible.builtin.file: + path: "{{ WORKDIR }}/backup" + state: directory + - name: Archive Git repository ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/{{ item }}.tar.gz -C {{ WORKDIR }} {{ item }}" with_items: "{{ BOOTSTRAP_REPOS }}" @@ -103,6 +113,12 @@ src: "{{ WORKDIR }}/secrets.tar.gz.enc" dest: "{{ WORKDIR }}/backup/secrets.tar.gz.enc" +thon3-swiftclient is a requirement of duplicity +- name: Install python3-swiftclient + ansible.builtin.package: + name: python3-swiftclient + state: present + - name: Backup with duplicity ansible.builtin.command: "duplicity --num-retries 3 --full-if-older-than 1M --progress --archive-dir {{ ARCHIVE_DIR }} --name {{ lookup('env','BACKUP_WORKFLOW') }} --allow-source-mismatch '{{ WORKDIR }}/backup' swift://{{ lookup('env','BACKUP_WORKFLOW') }}" environment: "{{ DUPLICITY_ENVIRONMENT }}" diff --git a/tasks/start.yml b/tasks/start.yml index a68c526..bfe6007 100755 --- a/tasks/start.yml +++ b/tasks/start.yml @@ -8,13 +8,9 @@ url: "https://{{ CLOUD_SERVER }}/s/{{ lookup('env','KEY') }}/download?path=%2F&files=secrets.tar.gz.enc" dest: /root/secrets.tar.gz.enc -# python3-swiftclient is a requirement of duplicity -- name: Install package requirements +- name: Install openssh-client ansible.builtin.package: - name: - - git - - python3-swiftclient - - openssh-client + name: openssh-client state: present - name: Create /root/.ssh directory @@ -118,6 +114,11 @@ - name: duplicity_cache size: 5 +- name: Install git + ansible.builtin.package: + name: git + state: present + - name: Install jsondiff from pip ansible.builtin.pip: name: jsondiff @@ -125,7 +126,3 @@ delegate_to: 172.17.0.1 become: true -- name: Create backup directory - ansible.builtin.file: - path: "{{ WORKDIR }}/backup" - state: directory