Append /sbin and /usr/sbin to $PATH for 'ip' commands

While the 'iproute' package is installed on our CentOS images, it
was found that '/sbin/ip' was not in PATH and thus resulting in a
command not found error.
This is because 'become: yes' may not include '/sbin' and '/usr/sbin'
paths [1].

This can also occur on other distributions so let's include this all
the time.

[1]: http://git.openstack.org/cgit/openstack/diskimage-builder/tree/diskimage_builder/lib/common-defaults?id=22e03f98209be206a1e9e60f0b9cd9381317096e#n46

Change-Id: Ia7480dab0f357b5710d1962a40499381837942b3
This commit is contained in:
David Moreau-Simard 2017-09-16 22:28:01 -04:00
parent e748a8a56b
commit e375ddc738
No known key found for this signature in database
GPG Key ID: 33A07694CBB71ECC
1 changed files with 7 additions and 0 deletions

View File

@ -1,9 +1,16 @@
- include: common.yaml
# Note (dmsimard)
# We explicitely declare a PATH environment variable because '/sbin' is not in
# PATH when using 'become: yes' on some distributions
- include: switch.yaml
environment:
PATH: "{{ ansible_env.PATH }}:/sbin:/usr/sbin"
when: inventory_hostname in groups['switch']
static: no
- include: peer.yaml
environment:
PATH: "{{ ansible_env.PATH }}:/sbin:/usr/sbin"
when: inventory_hostname in groups['peers']
static: no