updates to several things ;)

This commit is contained in:
Chris Hammer
2022-02-09 17:02:54 -05:00
parent 55c03f9901
commit 77c271c73d
7 changed files with 126 additions and 18 deletions

34
file-existence-test.yml Normal file
View File

@ -0,0 +1,34 @@
---
- name: Verify file existance and handle errors if needed
hosts: all
gather_facts: no
become: no
tasks:
- name: Run file test
block:
- name: "Test #1: register file contents"
command :
cmd : cat /tmp/hello-ansible.txt
changed_when : no
register : r_check_file
rescue:
- name: Exception caught
debug:
msg:
- "host : {{ inventory_hostname }}"
- "rc : {{ r_check_file.rc }}"
- "stdout : {{ r_check_file.stdout }}"
- "stderr : {{ r_check_file.stderr }}"
always:
- name: Job complete
debug:
msg: "Job has completed."
...