30 lines
751 B
YAML
30 lines
751 B
YAML
---
|
|
# This playbook backups the customers on hetzner server.
|
|
- name: Backup hetzner
|
|
hosts: all
|
|
gather_facts: true
|
|
|
|
tasks:
|
|
- include_vars: vars/hetzner/secret.yaml
|
|
- include_vars: vars/hetzner/variable.yaml
|
|
|
|
- name: Check if directories exist
|
|
stat:
|
|
path: "{{ backup_dir }}/{{ item.key }}"
|
|
register: dirs
|
|
loop: "{{ lookup('dict', customers) }}"
|
|
loop_control:
|
|
label: "{{ item.key }}"
|
|
|
|
- debug: var=dirs
|
|
|
|
# - name: Create not existing directories
|
|
# file:
|
|
# path: "{{ backup_dir }}/{{ item.item }}"
|
|
# state: directory
|
|
# mode: 0755
|
|
# when: item.stat.exists == false
|
|
# with_items: "{{ dirs.results }}"
|
|
# loop_control:
|
|
# label: "{{ item.item }}"
|