Only recently I started building a server for CentOS8, and I thought it was one shot with ansible, but it wasn't one shot, so it's a memo.
I feel that it will end if I raise the version of Ansible, but since I was told from the top that "the range of influence is ...", I responded without raising the version.
When I started CentOS 8 on EC2 and ran the playbook on ansible playbook
, I got an error like this
fatal: [server name]: FAILED! => {
"changed": false, "failed": true,
"module_stderr": "Shared connection to [server name] closed.\r\n",
"module_stdout": "/bin/sh: /usr/bin/python: No such file or directory\r\n",
"msg": "MODULE FAILURE",
"rc": 0
}
ansible2.3 works with python2, but CentOS8 does not have python2 installed by default __ Even if you link to python3 installed in / usr / bin / python, the operation cannot be guaranteed due to the difference in version (I do not know because I have not done it)
As I wrote at the beginning, it was said that the support for upgrading the version was NG, so install python2 and support it.
Install python2.7 on the CentOS8 server you are building
dnf install python2
After installation, create a symlink for python2.7
ln -s /usr/bin/python2.7 /usr/bin/python
It's okay if the link python-> /usr/bin/python2.7
is pasted like this
[root@hoge:~]$ll /usr/bin | grep python | grep -e "^l"
lrwxrwxrwx 1 root root 18 Oct 1 16:17 python -> /usr/bin/python2.7
lrwxrwxrwx. 1 root root 9 Jun 5 12:38 python2 -> python2.7
lrwxrwxrwx. 1 root root 25 Oct 1 16:04 python3 -> /etc/alternatives/python3
lrwxrwxrwx. 1 root root 31 Nov 21 2019 python3.6 -> /usr/libexec/platform-python3.6
lrwxrwxrwx. 1 root root 32 Nov 21 2019 python3.6m -> /usr/libexec/platform-python3.6m
lrwxrwxrwx. 1 root root 24 Oct 1 16:10 unversioned-python -> /etc/alternatives/python
You can now run your playbook from your old Ansible.
However, in this state, an error will occur in the new version of Ansible.
This can be avoided by including ansible_python_interpreter = / usr / bin / python3
in the new version of Ansible's hosts file.
[hoge-sv]
hoge001.net ansible_python_interpreter=/usr/bin/python3
Even CentOS8, which does not have python2 installed by default, can now run ansible by installing python2. Basically, I think it is better to upgrade the version.