Repository navigation
Chapter 2 - MODULE FAILURE with Rocky Linux 8 and Ansible 2.17+ (Python 3.6 vs 3.8+) #621
|
Hi, I am following Chapter 2 and encountering a MODULE FAILURE error when running vagrant provision against the geerlingguy/rockylinux8 box. Environment: Host OS: [e.g., Windows 11 / macOS / Ubuntu 24.04] fatal: [default]: FAILED! => {"changed": false, "module_stderr": "...", "msg": "MODULE FAILURE... No start of json char found"} Context: I understand that Rocky 8 uses Python 3.6 by default, which is unsupported by newer Ansible versions. I tried setting ansible_python_interpreter: "/usr/libexec/platform-python" in my Vagrantfile, but the issue persists. Could you clarify the recommended Ansible version for the current edition of the book, or confirm if I should switch the Vagrant box to rockylinux/9 to avoid Python 3.6 compatibility issues? Thanks! |
Replies: 1 comment
|
The geerlingguy/rockylinux8 Vagrant box uses Rocky Linux 8, which defaults to Python 3.6. Ansible 2.17+ (and generally 2.14+) dropped support for Python 3.6 on the controller side and requires Python 3.8+. You have two options to fix this. Option B is generally recommended for longevity. Option A: Downgrade Ansible (Keep Rocky 8) Create a Virtual Environment on your host machine with Python 3.9 or 3.10. Update your Vagrantfile to explicitly tell Ansible to use the platform Python on the guest: Option B: Upgrade to Rocky Linux 9 (Recommended) Change the Box in your Vagrantfile: Change this line:config.vm.box = "geerlingguy/rockylinux8"To this:config.vm.box = "rockylinux/9" ORconfig.vm.box = "geerlingguy/rockylinux9" No other changes are needed. Modern Ansible will detect Python 3.9 automatically, and dnf modules will work without extra configuration. |
The geerlingguy/rockylinux8 Vagrant box uses Rocky Linux 8, which defaults to Python 3.6.
Ansible 2.17+ (and generally 2.14+) dropped support for Python 3.6 on the controller side and requires Python 3.8+.
When you run modern Ansible against this box, it fails with MODULE FAILURE because it cannot execute modules (like dnf) using the guest's default Python 3.6.
You have two options to fix this. Option B is generally recommended for longevity.
Option A: Downgrade Ansible (Keep Rocky 8)
If you must use the geerlingguy/rockylinux8 box exactly as written in older editions of the book, you must use an older version of Ansible that still supports Python 3.6.
Create a Virtual Environment on your…