Failed to deploy nodes with centos7-min and centos8-min
While trying to setup G5K nodes with centos7-min or centos8-min, G5k.init()
yields an error:
# Run dhcp on the nodes
ERROR Failed hosts: api.py:1171
[_AnsibleExecutionRecord(host='ecotype-7.nantes.grid5000.fr',
status='FAILED', task='Run dhcp on the nodes', payload={'module_stdout':
'/bin/sh: python3: command not found\r\n', 'module_stderr': 'Shared
connection to ecotype-7.nantes.grid5000.fr closed.\r\n', 'msg': 'MODULE
FAILURE\nSee stdout/stderr for the exact error', 'rc': 127,
'_ansible_no_log': None, 'changed': False}),
_AnsibleExecutionRecord(host='econome-16.nantes.grid5000.fr',
The problem is there is no "python3" binary on the images provided by Grid'5000:
# centos7
$ python3 --version
-bash: python3: command not found
$ python --version
Python 2.7.5
$ /usr/libexec/platform-python --version
Python 2.7.5
Same for centos8-min, but this times there is a python3 interpreter at /usr/libexec/platform-python:
# centos8
$ python3 --version
-bash: python3: command not found
$ python --version
-bash: python: command not found
$ /usr/libexec/platform-python --version
Python 3.6.8
Ansible is supposed to find the /usr/libexec/platform-python
interpreter automatically: first based on distro and then based on a fixed list
But we override the interpreter to python3
in enoslib: https://gitlab.inria.fr/discovery/enoslib/-/blob/main/enoslib/api.py#L145
I think this overrides is here because older versions of Ansible had /usr/bin/python
as the default interpreter, and we don't know if it's python2 or python3. Ansible fixed it in version 5 (ansible-core 2.12.0).
TODO:
- check that python2 works correctly on target hosts
- if it does not, ask G5K admins to install python3 in centos7-min images
- see if we can let Ansible pick the interpreter without overriding it (would allow to support centos8-min)
- add CI tests on G5K to make sure we support at least basic deployments of these images