Fix python prereq install task
It's not possible to check ansible_pkg_mgr yet because we haven't gathered facts. This patch adjusts the task to run on all distros but it only has an effect on Ubuntu systems without python installed. Change-Id: I8859b740a4d190fb1548af7ed7df92c248e2c5a3
This commit is contained in:
parent
55e084b145
commit
56a388eb38
@ -13,6 +13,12 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
# NOTE(mhayden): CentOS always has python (because of yum), but it's possible
|
||||||
|
# that Ubuntu nodes may not have python by default. Ansible doesn't work very
|
||||||
|
# well if Python isn't installed.
|
||||||
|
#
|
||||||
|
# Also, we can't use a 'when' to check for the ansible_pkg_mgr here because
|
||||||
|
# we haven't gathered facts yet.
|
||||||
- name: Install Ansible prerequisites
|
- name: Install Ansible prerequisites
|
||||||
hosts: "{{ openstack_host_group|default('hosts') }}"
|
hosts: "{{ openstack_host_group|default('hosts') }}"
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
@ -20,9 +26,13 @@
|
|||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Ensure python is installed
|
- name: Ensure python is installed
|
||||||
register: result
|
register: result
|
||||||
raw: apt-get -y install python
|
raw: |
|
||||||
when:
|
if which apt-get >/dev/null && ! which python >/dev/null ; then
|
||||||
- ansible_pkg_mgr == 'apt'
|
apt-get -y install python
|
||||||
|
exit 2
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
changed_when: "result.rc == 2"
|
changed_when: "result.rc == 2"
|
||||||
failed_when: "{{ result.rc not in [0, 2] }}"
|
failed_when: "{{ result.rc not in [0, 2] }}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user