]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
Set ansible_python_interpreter to python3 if necessary
authorDavid Galloway <dgallowa@redhat.com>
Fri, 16 Nov 2018 21:43:49 +0000 (16:43 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 20 Nov 2018 16:11:11 +0000 (11:11 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
cephlab.yml
set_python_path.yml [new file with mode: 0644]

index bf297e3b1d19c3bc210d9773aa6bc92c85c81e38..4cfe3bb20367534c8ae1cc1e9668dcb9f6e08251 100644 (file)
@@ -1,4 +1,6 @@
 ---
+- import_playbook: set_python_path.yml
+
 # ensure the node is setup to be managed by ansible
 # eventually, most of the things here will be done by
 # cobbler / downburst / cloud-init.
diff --git a/set_python_path.yml b/set_python_path.yml
new file mode 100644 (file)
index 0000000..3c8f7cc
--- /dev/null
@@ -0,0 +1,18 @@
+---
+# This will set ansible_python_interpreter to use python3
+# if the shell module fails (like it will on RHEL8 since
+# /usr/bin/python is no more).
+- hosts: all
+  gather_facts: false
+  vars:
+    ansible_ssh_user: "{{ cm_user }}"
+  become: true
+  tasks:
+    - name: Check for /usr/bin/python
+      shell: echo marco
+      register: polo
+      ignore_errors: true
+    - name: Set ansible_python_interpreter=/usr/bin/python3
+      set_fact:
+        ansible_python_interpreter: /usr/bin/python3
+      when: polo.rc != 0