From e375ddc738d6554bcbb07d979b6ac076837716bb Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Sat, 16 Sep 2017 22:28:01 -0400 Subject: [PATCH] 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 --- roles/multi-node-bridge/tasks/main.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/multi-node-bridge/tasks/main.yaml b/roles/multi-node-bridge/tasks/main.yaml index 046d35e61..20ee7e27e 100644 --- a/roles/multi-node-bridge/tasks/main.yaml +++ b/roles/multi-node-bridge/tasks/main.yaml @@ -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