--- - name: Setup backup storage password copy: content: "{{ backup_storage_key }}" dest: "{{ backup_home }}/.borg.key" owner: "{{ backup_owner }}" group: "{{ backup_group }}" mode: "0600" - name: Setup ssh folder file: state: directory path: "{{ backup_home }}/.ssh" owner: "{{ backup_owner }}" group: "{{ backup_group }}" mode: "0700" - name: Setup ssh keys copy: content: "{{ item.content }}" dest: "{{ backup_home }}/.ssh/{{ item.file }}" owner: "{{ backup_owner }}" group: "{{ backup_group }}" mode: "0600" loop: - content: "{{ backup_owner_ssh_private_key }}" file: "id_rsa" - content: "{{ backup_owner_ssh_public_key }}" file: "id_rsa.pub" loop_control: label: "{{ item.file }}" - name: setup backup script template: src: "./usr/local/bin/{{ backup_host }}-backup.sh.j2" dest: "/usr/local/bin/backup.sh" owner: "{{ backup_owner }}" group: "{{ backup_group }}" mode: "0750" - name: setup cron backup job cron: name: "{{ backup_host }} backup" user: "{{ backup_owner }}" job: "/usr/local/bin/backup.sh" special_time: "{{ backup_special_time }}"