diff --git a/tasks/configure.yml b/tasks/configure.yml index 1ca1856..8d90625 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -8,14 +8,26 @@ msg: "{{ which_puppet }}" - name: Obtain path to puppet binary using whereis - shell: "whereis -b puppet | awk 'BEGIN {FS=\" \"} {print($2)}'" + shell: "whereis -b puppet | awk 'BEGIN {FS=\": \"} {print($2)}'" register: which_puppet when: which_puppet.stdout == "" +- name: Get puppet permissions + stat: + path: "{{ which_puppet.stdout }}" + register: which_puppet_stat + - name: Set fact for puppet path set_fact: puppet_cmd: "{{ which_puppet.stdout }}" - when: which_puppet.stdout != "" + when: + - which_puppet.stdout != "" + - which_puppet_stat.stat.executable + +- name: Set fact for puppet path to estimated path when not found + set_fact: + puppet_cmd: "/usr/local/bin/puppet" + when: which_puppet.stdout == "" or not which_puppet_stat.stat.executable - name: Obtain puppet configuration directory shell: "{{ puppet_cmd }} config print confdir"