Revert "Fix syntax error and refactor."
This reverts commit 118dcf0f78
.
This commit is contained in:
parent
7e6e99ae33
commit
99207a7bbf
@ -7,6 +7,11 @@
|
|||||||
ansible.builtin.include_tasks: "tasks/assert_var_not_empty.yml"
|
ansible.builtin.include_tasks: "tasks/assert_var_not_empty.yml"
|
||||||
with_items: "{{ BACKUP_OVH1_REQUIRED_VARS }}"
|
with_items: "{{ BACKUP_OVH1_REQUIRED_VARS }}"
|
||||||
|
|
||||||
|
- name: Create backup directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ WORKDIR }}/backup"
|
||||||
|
state: directory
|
||||||
|
|
||||||
- name: Archive volumes
|
- name: Archive volumes
|
||||||
ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/{{ item }}.tar.gz -C /mnt/volumes {{ item }}"
|
ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/{{ item }}.tar.gz -C /mnt/volumes {{ item }}"
|
||||||
with_items: "{{ BACKUP_OVH1_VOLUMES }}"
|
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 }}"
|
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 }}"
|
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
|
- 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') }}"
|
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 }}"
|
environment: "{{ DUPLICITY_ENVIRONMENT }}"
|
||||||
|
@ -12,6 +12,11 @@
|
|||||||
url: "https://{{ CLOUD_SERVER }}/s/{{ lookup('env','KEY') }}/download?path=%2F&files=secrets.tar.gz.enc"
|
url: "https://{{ CLOUD_SERVER }}/s/{{ lookup('env','KEY') }}/download?path=%2F&files=secrets.tar.gz.enc"
|
||||||
dest: "{{ WORKDIR }}/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
|
- name: Create /root/.ssh directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /root/.ssh
|
path: /root/.ssh
|
||||||
@ -94,6 +99,11 @@
|
|||||||
dest: "{{ WORKDIR }}/{{ item }}"
|
dest: "{{ WORKDIR }}/{{ item }}"
|
||||||
with_items: "{{ BOOTSTRAP_REPOS }}"
|
with_items: "{{ BOOTSTRAP_REPOS }}"
|
||||||
|
|
||||||
|
- name: Create backup directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ WORKDIR }}/backup"
|
||||||
|
state: directory
|
||||||
|
|
||||||
- name: Archive Git repository
|
- name: Archive Git repository
|
||||||
ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/{{ item }}.tar.gz -C {{ WORKDIR }} {{ item }}"
|
ansible.builtin.command: "tar -czf {{ WORKDIR }}/backup/{{ item }}.tar.gz -C {{ WORKDIR }} {{ item }}"
|
||||||
with_items: "{{ BOOTSTRAP_REPOS }}"
|
with_items: "{{ BOOTSTRAP_REPOS }}"
|
||||||
@ -103,6 +113,12 @@
|
|||||||
src: "{{ WORKDIR }}/secrets.tar.gz.enc"
|
src: "{{ WORKDIR }}/secrets.tar.gz.enc"
|
||||||
dest: "{{ WORKDIR }}/backup/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
|
- 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') }}"
|
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 }}"
|
environment: "{{ DUPLICITY_ENVIRONMENT }}"
|
||||||
|
@ -8,13 +8,9 @@
|
|||||||
url: "https://{{ CLOUD_SERVER }}/s/{{ lookup('env','KEY') }}/download?path=%2F&files=secrets.tar.gz.enc"
|
url: "https://{{ CLOUD_SERVER }}/s/{{ lookup('env','KEY') }}/download?path=%2F&files=secrets.tar.gz.enc"
|
||||||
dest: /root/secrets.tar.gz.enc
|
dest: /root/secrets.tar.gz.enc
|
||||||
|
|
||||||
# python3-swiftclient is a requirement of duplicity
|
- name: Install openssh-client
|
||||||
- name: Install package requirements
|
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name: openssh-client
|
||||||
- git
|
|
||||||
- python3-swiftclient
|
|
||||||
- openssh-client
|
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Create /root/.ssh directory
|
- name: Create /root/.ssh directory
|
||||||
@ -118,6 +114,11 @@
|
|||||||
- name: duplicity_cache
|
- name: duplicity_cache
|
||||||
size: 5
|
size: 5
|
||||||
|
|
||||||
|
- name: Install git
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: git
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Install jsondiff from pip
|
- name: Install jsondiff from pip
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: jsondiff
|
name: jsondiff
|
||||||
@ -125,7 +126,3 @@
|
|||||||
delegate_to: 172.17.0.1
|
delegate_to: 172.17.0.1
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Create backup directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ WORKDIR }}/backup"
|
|
||||||
state: directory
|
|
||||||
|
Loading…
Reference in New Issue
Block a user