From 27702191b996074e994321dfa7fb7363b652f8d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Mon, 27 Dec 2021 15:40:01 +0100
Subject: [PATCH] Use command not shell (ansible-lint)

---
 tasks/main.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tasks/main.yml b/tasks/main.yml
index 3e07074..55b58f1 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
-- 
GitLab