From: David Galloway Date: Fri, 16 Nov 2018 21:43:49 +0000 (-0500) Subject: Set ansible_python_interpreter to python3 if necessary X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2c90635842522bf5816975f64311cb3c7cf32263;p=ceph-cm-ansible.git Set ansible_python_interpreter to python3 if necessary Signed-off-by: David Galloway --- diff --git a/cephlab.yml b/cephlab.yml index bf297e3..4cfe3bb 100644 --- a/cephlab.yml +++ b/cephlab.yml @@ -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 index 0000000..3c8f7cc --- /dev/null +++ b/set_python_path.yml @@ -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