diff --git a/tasks/main.yml b/tasks/main.yml index 3e070746aea5a9e397e6e0147e24fead96fa3146..55b58f14661dc83f3b44bc6b50ac7ed73648c360 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,7 +5,7 @@ generate_ssh_key: true - name: Get public key - shell: "cat /root/.ssh/id_rsa.pub" + command: "cat /root/.ssh/id_rsa.pub" register: hostkey changed_when: false @@ -37,7 +37,9 @@ key: "{{ borgbackup_target_ip }} ssh-ed25519 {{ hostvars[borgbackup_target_host]['ansible_ssh_host_key_ed25519_public'] }}" - name: Create Borg Repo - shell: "BORG_PASSPHRASE={{ borgbackup_key }} borg init -e repokey borgbackup@{{ borgbackup_target_ip }}:backup" + command: "borg init -e repokey borgbackup@{{ borgbackup_target_ip }}:backup" + environment: + BORG_PASSPHRASE: "{{ borgbackup_key }}" when: not repo.stat.exists - name: Install borgmatic