- hosts: es-backup
  gather_facts: no
  become: yes
  vars_files:
    - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml']
  vars:
    - es_snapshot_host: "{{app_es_snapshot_host}}"
    - snapshot_base_path: "{{app_snapshot_base_path}}"
  roles:
    - es-azure-snapshot
    - es5-snapshot-purge
  tags:
    - es_backup

- hosts: "{{remote}}"
  gather_facts: no
  become: yes
  vars_files:
    - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml']
  vars:
    - es_restore_host: "{{remote}}"
    - snapshot_base_path: "{{app_snapshot_base_path}}"
  roles:
    - es-azure-restore
  tags:
    - es_restore

- hosts: log-es-backup
  gather_facts: no
  become: yes
  vars_files:
    - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml']
  vars:
    - es_snapshot_host: "{{log_es_snapshot_host}}"
    - snapshot_base_path: "{{log_snapshot_base_path}}"
  roles:
    - es-azure-snapshot
    - es2-snapshot-purge
  tags:
    - log_es_backup

- hosts: "{{remote}}"
  gather_facts: no
  become: yes
  vars_files:
    - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml']
  vars:
    - es_restore_host: "{{remote}}"
    - snapshot_base_path: "{{log_snapshot_base_path}}"
  roles:
    - es-azure-restore
  tags:
    - log_es_restore

- hosts: log-es
  gather_facts: no
  become: yes
  vars_files:
    - ['{{inventory_dir}}/secrets.yml', 'secrets/{{env}}.yml']
  roles:
    - es2-data-purge
  tags:
    - purge_old_logs
