From af7de5fbbcaf3daafa961376dedd6ca10840c267 Mon Sep 17 00:00:00 2001 From: Claudio Maradonna Date: Thu, 1 Dec 2022 11:45:28 +0100 Subject: [PATCH] fix missing directory structure creation before file copy for hardening-basic --- roles/hardening-basic/tasks/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/roles/hardening-basic/tasks/main.yml b/roles/hardening-basic/tasks/main.yml index 9754d8c..f69a529 100644 --- a/roles/hardening-basic/tasks/main.yml +++ b/roles/hardening-basic/tasks/main.yml @@ -3,6 +3,14 @@ - name: Basic Hardening block: + - name: Create directory structure + ansible.builtin.file: + path: '/etc/{{ item.path }}' + state: directory + mode: '{{ item.mode }}' + with_community.general.filetree: '../templates/basic/etc/' + when: item.state == 'directory' + - name: Create and copy hardening files ansible.builtin.template: src: '{{ item.src }}' @@ -13,6 +21,14 @@ - name: Harden SSH Config when: 'hardening_sshd_enabled is true' block: + - name: Create directory structure + ansible.builtin.file: + path: '/etc/{{ item.path }}' + state: directory + mode: '{{ item.mode }}' + with_community.general.filetree: '../templates/ssh/etc/' + when: item.state == 'directory' + - name: Create and copy hardening files ansible.builtin.template: src: '{{ item.src }}'