From c5e240708689a19fd47292c47feff9ff94dd0994 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 5 Aug 2014 15:19:36 +0900 Subject: [PATCH] use set_fact for finding sshd_config --- ansible/sshd_config.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ansible/sshd_config.yml b/ansible/sshd_config.yml index 3586414..9fcea0b 100644 --- a/ansible/sshd_config.yml +++ b/ansible/sshd_config.yml @@ -1,9 +1,16 @@ --- - hosts: all - vars: - conf: /etc/ssh/sshd_config + # vars: + # conf: /etc/ssh/sshd_config sudo: yes tasks: + - name: find sshd_config + set_fact: conf={{item}} + with_first_found: + - /etc/ssh/sshd_config + - /etc/sshd_config + - name: assert sshd_config found + assert: conf is defined - name: Protocol 2 lineinfile: dest={{conf}} regexp="^(#)?Protocol"