Bug 1670520

Summary: fails to complete when /usr/bin/python is not found
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Alfredo Deza <adeza>
Component: Ceph-AnsibleAssignee: Guillaume Abrioux <gabrioux>
Status: CLOSED ERRATA QA Contact: Vasishta <vashastr>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.2CC: anharris, aschoen, ceph-eng-bugs, ceph-qe-bugs, gmeno, nthomas, tchandra, tserlin
Target Milestone: rc   
Target Release: 4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-ansible-4.0.0beta1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-31 12:45:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alfredo Deza 2019-01-29 18:05:17 UTC
Description of problem: When deploying containers, the `site-docker.yml.sample` does not have the pre-tasks that `site.yml.sample` does which ensures Python2 is installed and available, this causes the playbook to fail as it can't find a Python executable.


How reproducible: 100% of the time


Steps to Reproduce:
1. On a Python3 system (e.g. Ubuntu Bionic) use site-docker.yml.sample to deploy
2. 
3.

Actual results: Failure happens with messaging like:

> failed: [node1 -> node4] (item=node4) => {"changed": false, "item": "node4", "module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 127}


Expected results: playbook installs missing dependencies if any


Additional info:
Adding the same pre-tasks that exist in site.yml.sample allows the playbook to continue:

git diff
diff --git a/site-docker.yml.sample b/site-docker.yml.sample
index 82099535..bf23397a 100644
--- a/site-docker.yml.sample
+++ b/site-docker.yml.sample
@@ -23,6 +23,32 @@
     delegate_facts_host: True

   pre_tasks:
+    # If we can't get python2 installed before any module is used we will fail
+    # so just try what we can to get it installed
+    - name: check for python2
+      stat:
+        path: /usr/bin/python
+      ignore_errors: yes
+      register: systempython2
+
+    - name: install python2 for debian based systems
+      raw: sudo apt-get -y install python-simplejson
+      ignore_errors: yes
+      when:
+        - systempython2.stat is undefined or systempython2.stat.exists == false
+
+    - name: install python2 for fedora
+      raw: sudo dnf -y install python creates=/usr/bin/python
+      ignore_errors: yes
+      when:
+        - systempython2.stat is undefined or systempython2.stat.exists == false
+
+    - name: install python2 for opensuse
+      raw: sudo zypper -n install python-base creates=/usr/bin/python2.7
+      ignore_errors: yes
+      when:
+        - systempython2.stat is undefined or systempython2.stat.exists == false
+
     - name: gather facts
       setup:
       when:

Comment 3 Giridhar Ramaraju 2019-08-05 13:06:04 UTC
Updating the QA Contact to a Hemant. Hemant will be rerouting them to the appropriate QE Associate. 

Regards,
Giri

Comment 4 Giridhar Ramaraju 2019-08-05 13:08:47 UTC
Updating the QA Contact to a Hemant. Hemant will be rerouting them to the appropriate QE Associate. 

Regards,
Giri

Comment 8 errata-xmlrpc 2020-01-31 12:45:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0312