From dc272820f4081c3f3e9506aa00ee4f52859bb3dd Mon Sep 17 00:00:00 2001 From: Adrien Date: Wed, 12 Feb 2020 09:07:25 +0100 Subject: [PATCH] Validate config at deploy --- tasks/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 5625b3a..2156f6c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,7 +21,15 @@ # notify: Restart ssh - name: Installation de la configuration ssh - template: src="{{ item }}" dest=/etc/ssh/sshd_config owner=root group=root mode=0600 + template: + src: "{{ item }}" + dest: /etc/ssh/sshd_config + owner: root + group: root + mode: 0600 + backup: 'yes' + validate: '/usr/sbin/sshd -t -f %s' + with_first_found: - files: - sshd_config-{{ ansible_hostname }}.j2