--- - name: Skip hosts without backup config ansible.builtin.debug: msg: "No entry in backup_hosts for {{ inventory_hostname }}; skipping backup role." when: inventory_hostname not in (backup_hosts | default({})) - name: Configure borgmatic when: inventory_hostname in (backup_hosts | default({})) block: - name: Install borgmatic ansible.builtin.package: name: borgmatic state: present - name: Ensure /etc/borgmatic exists ansible.builtin.file: path: /etc/borgmatic state: directory owner: root group: root mode: '0750' - name: Deploy borgmatic config ansible.builtin.template: src: borgmatic.yaml.j2 dest: /etc/borgmatic/config.yaml owner: root group: root mode: '0640'