You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
787 B
YAML

---
- name: Backup Docker Volumes.
hosts: localhost
# become: true
tasks:
- name: Find Containers With Backup Label
docker_host_info:
containers: true
containers_filters:
label:
- "ie.cianhatton.backup.enabled=true"
register: filter_output
- name: Get Container Names
ansible.builtin.set_fact: container_names="{{ filter_output.containers | map(attribute="Names") | flatten }}"
- name: Backup Containers with backup label
ansible.builtin.include_role:
name: docker_s3_backup
vars:
container_backup: "{{ container_item | regex_replace('^\\/', '') }}"
docker_backup_retain_count: 7
with_items: "{{ container_names }}"
loop_control:
loop_var: container_item