--- - name: install requirements for backup system apt: update_cache: yes state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}" install_recommends: yes pkg: - borgbackup - name: generate backup ssh user user: name: "{{ backup_owner }}" group: "{{ backup_group }}" comment: backup user shell: /bin/sh - name: Setup User ssh_key authorized_key: user: "{{ backup_owner }}" key: "{{ backup_owner_ssh_key }}" - name: setup backup location file: state: directory path: "{{ backup_folder }}" owner: "{{ backup_owner }}" group: "{{ backup_group }}" mode: "0750" - name: setup backup storage file: state: directory path: "{{ backup_storage }}" owner: "{{ backup_owner }}" group: "{{ backup_group }}" mode: "0777" - include_tasks: master.yml when: not backup_client - include_tasks: client.yml when: backup_client