install python-xml on SUSE/openSUSE only if python2 is installed

raw_install_python.yml: on SUSE/openSUSE, install python-xml package only
if python2 is installed already

Background:
On SLES 15.x / openSUSE Leap 15.x, the python2 package `python-base` provides
/usr/bin/python, while python3 only provides /usr/bin/python3.

Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
pull/4486/head
Johannes Kastl 2019-08-20 13:32:32 +02:00 committed by Guillaume Abrioux
parent 5cf22e9b31
commit a1811ca097
1 changed files with 11 additions and 0 deletions

View File

@ -56,3 +56,14 @@
until: result is succeeded
when: stat_zypper.rc == 0
when: not True in (systempython.results | selectattr('stat', 'defined') | map(attribute='stat.exists') | list | unique)
- name: install python-xml for opensuse only if python2 is installed already
raw: zypper -n install python-xml
register: result
until: result is succeeded
with_items: "{{ systempython.results }}"
when:
- stat_zypper.rc is defined
- stat_zypper.rc == 0
- item.stat.exists | bool
- item.stat.path == '/usr/bin/python'