From a80054f666389c9d612ed069a1f551c6eabec0d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Thu, 1 Sep 2022 19:24:04 +0200
Subject: [PATCH] [FIX] get template locally before pushing

---
 tasks/main.yml | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tasks/main.yml b/tasks/main.yml
index 0ae2e69..3bcf5d9 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -19,9 +19,29 @@
     exclusive: true
   with_items: "{{ groups.all | difference(groups.backup_server) }}"
 
-- name: Get sshd_config file from init_server role
+- name: create templates directory
+  file:
+    name: templates
+    state: directory
+    mode: '0755'
+  connection: local
+  become: false
+  delegate_to: localhost
+  tags: sshd
+
+- name: Get sshd_config file from init_server role locally
   get_url:
     url: "https://sources.le-filament.com/lefilament/ansible-roles/init_server/-/raw/master/templates/sshd_config.j2"
+    dest: templates/sshd_config.j2
+    mode: '0644'
+  connection: local
+  become: false
+  delegate_to: localhost
+  tags: sshd
+
+- name: Copy sshd_config file
+  template:
+    src: templates/sshd_config.j2
     dest: /etc/ssh/sshd_config
     owner: root
     group: root
-- 
GitLab