Add check for executable path
This commit is contained in:
parent
df58f265d7
commit
a0b4b08319
1 changed files with 14 additions and 2 deletions
|
@ -8,14 +8,26 @@
|
||||||
msg: "{{ which_puppet }}"
|
msg: "{{ which_puppet }}"
|
||||||
|
|
||||||
- name: Obtain path to puppet binary using whereis
|
- 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
|
register: which_puppet
|
||||||
when: which_puppet.stdout == ""
|
when: which_puppet.stdout == ""
|
||||||
|
|
||||||
|
- name: Get puppet permissions
|
||||||
|
stat:
|
||||||
|
path: "{{ which_puppet.stdout }}"
|
||||||
|
register: which_puppet_stat
|
||||||
|
|
||||||
- name: Set fact for puppet path
|
- name: Set fact for puppet path
|
||||||
set_fact:
|
set_fact:
|
||||||
puppet_cmd: "{{ which_puppet.stdout }}"
|
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
|
- name: Obtain puppet configuration directory
|
||||||
shell: "{{ puppet_cmd }} config print confdir"
|
shell: "{{ puppet_cmd }} config print confdir"
|
||||||
|
|
Loading…
Reference in a new issue