main.yml (707B)
1 --- 2 - name: Install Borg package 3 apt: 4 name: 5 - borgbackup 6 - gzip 7 state: latest 8 when: ansible_os_family == 'Debian' 9 10 # This step should not be needed, how else did we log in. 11 # That said, can't hurt and seems cleaner to have it. 12 - name: Ensure /root/.ssh/ directory exists 13 file: 14 path: "/root/.ssh/" 15 state: directory 16 owner: root 17 group: root 18 mode: "0744" 19 20 - name: Create SSH key pair for use for backups by root 21 ansible.builtin.command: 22 cmd: "ssh-keygen -P '' -t ed25519 -f /root/.ssh/borg" 23 creates: /root/.ssh/borg.pub 24 become: true 25 become_user: root 26 27 - name: Fetch file to local system 28 fetch: 29 src: "/root/.ssh/borg.pub" 30 dest: "../borg.pub"