From 2f90091f0a4c1136bc6de1f39850cc5f502ccd13 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Fri, 16 Dec 2016 00:36:32 +0100 Subject: [PATCH] Add an important example for SSHd Sudoers is a great example to show how you can prevent shutting yourself out. But SSHd is at least as important to avoid syntax errors causing a lot of grieve. So I think it deserves a spot in this list :-) --- lib/ansible/modules/files/template.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/modules/files/template.py b/lib/ansible/modules/files/template.py index c603ec8f42..3ba25d50c1 100644 --- a/lib/ansible/modules/files/template.py +++ b/lib/ansible/modules/files/template.py @@ -101,4 +101,14 @@ EXAMPLES = ''' src: /mine/sudoers dest: /etc/sudoers validate: 'visudo -cf %s' + +# Update SSH configuration safely (avoid shutting yourself out) +- template: + src: etc/ssh/sshd_config.j2 + dest: /etc/ssh/sshd_config.j2 + owner: root + group: root + mode: '0600' + validate: /usr/sbin/sshd -t %s + backup: yes '''