Installation does not work on CentOS 7 with python3 interpreter
colenot opened this issue · comments
Installing nginx in a playbook with python3 interpreter enabled on host does not work.
Yum (and firewalld) modules need python2 interpreter to work on CentOS 7.
But python2 is deprecated, and some ansible modules need python3 interpreter (incudling crypto collection).
Workaround is changing interpreter for python2 for install tasks :
`# Python 2 must be used for installation on CentOS 7
-
name: "Define Python Interpreter"
set_fact:
my_interpreter: "{{ ansible_python_interpreter }}" -
name: "Override Python Interpeter for CentOS7"
set_fact:
ansible_python_interpreter: "/bin/python2"
when:- "ansible_distribution == 'CentOS'"
- "ansible_distribution_major_version | int == 7"
-
name: Install prerequisites
become: yes
package:
name: [...] -
name: "Restore Python Interpeter"
set_fact:
ansible_python_interpreter: "{{ my_interpreter }}"`
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.