From 3c890bca5dc41b45225c855a1d24c7990f8f5f1f Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Fri, 10 Feb 2023 02:29:27 +0100 Subject: [PATCH] feat(tasks): Confirm stat is working as expected (#1) --- tasks/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tasks/main.yml diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..44c7237 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,24 @@ +--- + +- name: 'Stat {{ ''{{'' }} configroot {{ ''}}'' }}' + tags: + - 'testing' + register: configroot_stat + ansible.builtin.stat: + path: {{ configroot }} + + + +- name: 'Print {{ ''{{'' }} configroot {{ ''}}'' }} stat result' + tags: + - 'testing' + when: '(configroot_stat.stat.exists is defined and configroot_stat.stat.exists)' + ansible.builtin.debug: + msg: 'Location {{ ''{{'' }} configroot {{ ''}}'' }} (''{{ configroot }}'') is {% if not configroot_stat.stat.exists %}not {% endif %}writable{% if not configroot_stat.stat.exists %}, ending play prematurely ...{% endif %}' + + + +- meta: end_play + tags: + - 'testing' + when: '(configroot_stat.stat.exists is defined and not configroot_stat.stat.exists)'