Openshift-ansible: Running the prerequisites.yml playbook in Fedora 27 fails

Created on 13 Apr 2018  路  2Comments  路  Source: openshift/openshift-ansible

Description

Running the prerequisites.yml playbook in latest master in Fedora 27 fails.

Version

Please put the following version information in the code block
indicated below.

  • Your ansible version per ansible --version

If you're operating from a git clone:

  • The output of git describe

If you're running from playbooks installed via RPM

  • The output of rpm -q openshift-ansible

Place the output between the code block below:

ansible 2.5.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Aug 16 2017, 12:56:26) [GCC 7.1.1 20170802 (Red Hat 7.1.1-7)]

[root@hedy openshift-ansible]# git describe
openshift-ansible-3.10.0-0.20.0-16-ge54c3457b
Steps To Reproduce
  1. Run "ansible-playbook -i inventory/hosts.localhost playbooks/prerequisites.yml"
Expected Results

The playbook should finish and deploy the prerequisites for setting up a basic all in one Openshift cluster in localhost.

(...)

TASK [openshift_version : debug] ********************************************************************************************************************************************
Thursday 12 April 2018  20:21:26 +0000 (0:00:00.770)       0:02:51.143 ******** 
ok: [localhost] => {
    "openshift_pkg_version": "-3.7*"
}

TASK [openshift_version : debug] ********************************************************************************************************************************************
Thursday 12 April 2018  20:21:27 +0000 (0:00:00.766)       0:02:51.910 ******** 
ok: [localhost] => {
    "openshift_version": "3.7"
}

TASK [set openshift_version booleans (first master)] ************************************************************************************************************************
Thursday 12 April 2018  20:21:28 +0000 (0:00:00.743)       0:02:52.653 ******** 
ok: [localhost]

PLAY [Set openshift_version for etcd, node, and master hosts] ***************************************************************************************************************
skipping: no hosts matched

PLAY [Verify Requirements] **************************************************************************************************************************************************

TASK [Run variable sanity checks] *******************************************************************************************************************************************
Thursday 12 April 2018  20:21:29 +0000 (0:00:00.890)       0:02:53.544 ******** 
fatal: [localhost]: FAILED! => {"msg": "last_checked_host: localhost, last_checked_var: ansible_python;openshift-ansible requires Python 3 for Fedora; For information on enabling Python 3 with Ansible, see https://docs.ansible.com/ansible/python_3_support.html"}

NO MORE HOSTS LEFT **********************************************************************************************************************************************************

PLAY RECAP ******************************************************************************************************************************************************************
localhost                  : ok=46   changed=0    unreachable=0    failed=1   


INSTALLER STATUS ************************************************************************************************************************************************************
Initialization             : In Progress (0:02:55)
Observed Results

The playbook fails and it's not possible to continue with the deployment. Appears to be a problem with using some package with the py2 version, even though I'm using py3. I've tried the following: adding py3 as default interpreter in the inventory; use a py3 virtualenv.

For long output or logs, consider using a gist

Additional Information

Provide any additional information which may help us diagnose the
issue.

  • Your operating system and version, ie: RHEL 7.2, Fedora 23 ($ cat /etc/redhat-release)
  • Your inventory file (especially any non-standard configuration parameters)
  • Sample code, etc
* Operating system and version: Fedora 27
* Inventory file
[root@hedy ~]# cat openshift-ansible/inventory/hosts.localhost 
#bare minimum hostfile

[OSEv3:children]
masters
nodes
etcd

[OSEv3:vars]
# if your target hosts are Fedora uncomment this
#ansible_python_interpreter=/usr/bin/python3
openshift_deployment_type=origin
openshift_release=3.7
osm_cluster_network_cidr=10.128.0.0/14
openshift_portal_net=172.30.0.0/16
osm_host_subnet_length=9
# localhost likely doesn't meet the minimum requirements
openshift_disable_check=disk_availability,memory_availability
ansible_python_interpreter=/usr/bin/python3

[masters]
localhost ansible_connection=local

[etcd]
localhost ansible_connection=local

[nodes]
localhost  ansible_connection=local openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'zone': 'default'}"

Most helpful comment

This line needs to be uncommented on Fedora

I missed it at first too; it looks like ansible_python_interpreter=/usr/bin/python3 is uncommented later on in the sample file provided, it is the last line in the [OSEv3:vars] section.

For anyone else who comes across this and you continue to experience this error despite having ansible_python_interpreter=/usr/bin/python3 in your inventory, you have to ensure that the host you're running the playbook from is actually executing ansible using python3. If you just did a dnf install ansible, you are probably executing with Python2. For Fedora users, you need to:

sudo dnf install ansible-python3 -y

In addition, you still need the ansible_python_interpreter=/usr/bin/python3 variable defined to ensure that you actually use your newly-install ansible-python3, but just re-running the playbook works for me afterwards.

All 2 comments

ansible_python_interpreter=/usr/bin/python3

This line needs to be uncommented on Fedora

This line needs to be uncommented on Fedora

I missed it at first too; it looks like ansible_python_interpreter=/usr/bin/python3 is uncommented later on in the sample file provided, it is the last line in the [OSEv3:vars] section.

For anyone else who comes across this and you continue to experience this error despite having ansible_python_interpreter=/usr/bin/python3 in your inventory, you have to ensure that the host you're running the playbook from is actually executing ansible using python3. If you just did a dnf install ansible, you are probably executing with Python2. For Fedora users, you need to:

sudo dnf install ansible-python3 -y

In addition, you still need the ansible_python_interpreter=/usr/bin/python3 variable defined to ensure that you actually use your newly-install ansible-python3, but just re-running the playbook works for me afterwards.

Was this page helpful?
0 / 5 - 0 ratings