-
-
Save VladislavMS/abbb7bd4142169c77532a7ec1bc9dd2f to your computer and use it in GitHub Desktop.
Ansible playbook to backup all Docker volumes in a remote host and then upload the backup file to a raw Nexus repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: remote | |
gather_facts: no | |
tasks: | |
- name: Make the volumes backup | |
archive: | |
path: /var/lib/docker/volumes | |
dest: volumes.tar.gz | |
- name: Make the backup available (requires vault-password-file) | |
uri: | |
url: https://www.example.com/nexus/repository/backups/volumes.tar.gz | |
method: PUT | |
src: volumes.tar.gz | |
remote_src: true | |
user: admin | |
password: "{{ nexus_password }}" | |
force_basic_auth: yes | |
headers: | |
Content-Type: application/octet-stream | |
vars: | |
nexus_password: !vault | | |
$ANSIBLE_VAULT;1.1;AES256 | |
00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
00000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
0000 | |
register: upload_result | |
failed_when: upload_result.status != 201 | |
changed_when: upload_result.status == 201 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment