Safely fail when logs cannot be found
On first runs, this logfile is not going to be found. This is causing ansible to crash and stop applying puppet in consecutive nodes. Add a condition to safely fail, and abort play if no files can be found. Change-Id: I22a5ebbcaa603b25920fd638211f3663e81e09b0
This commit is contained in:
parent
54fabcffd1
commit
139ca911ab
@ -67,6 +67,7 @@
|
||||
- name: find logs
|
||||
shell: "ls -tr /var/lib/puppet/reports/{{ ansible_fqdn }}/*_puppetdb.json"
|
||||
register: files
|
||||
failed_when: files.stdout_lines|default("") == ""
|
||||
|
||||
- name: set log filename
|
||||
set_fact: puppet_logfile="{{ files.stdout_lines|sort|last }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user