You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I converted an old Macbook Pro to Linux Mint (Linux Mint 22.1
) and tried to follow the example in Chapter two of your book and ran into a nightmare. After a long chat with ChatGPT:
Here's a summary of our discussion and the key takeaways:
🧵 Problem Summary
You were trying to use Ansible with a Rocky Linux 8 Vagrant VM and ran into these issues:
❌ Ansible failed with: "MODULE FAILURE: No start of json char found"
This occurred when using modules like dnf, indicating broken Python compatibility.
❌ Rocky Linux 8 default Python is 3.6 (platform-python), which:
Is too old for modern Ansible (v2.14+ requires Python ≥3.8)
Has system-specific behavior that can confuse Ansible
❌ You tried installing Ansible 2.12 (compatible with Python 3.6), but:
Your host system uses Python 3.12
Ansible 2.12 is incompatible with Python 3.12, resulting in _AnsiblePathHookFinder errors
❌ You tried installing Python 3.9 using apt, but Mint's base repos didn’t include it
✅ Working Solution (Step-by-Step)
🔧 1. Install a compatible Python (3.9 or 3.10) on your host
Using the deadsnakes PPA, you can install Python 3.10 like so:
And keep your Ansible version at 2.12.x, which supports Python 3.6.
✅ Alternatives you considered:
Installing Python 3.9 in the Rocky guest → failed due to missing dnf bindings
Using newer Ansible → failed due to Python 3.6 on guest
Using raw commands instead of Ansible modules → possible workaround
Here's the new working Vagrantfile that pairs perfectly with:
Ansible 2.12 (installed in a Python 3.10 virtual environment on your host)
Rocky Linux 8 guest
The system Python (platform-python, Python 3.6) on the guest VM — which is fully compatible with Ansible 2.12 for DNF, systemd, etc.
✅ Final Working Vagrantfile
Vagrant.configure("2")do |config|
config.vm.box="geerlingguy/rockylinux8"config.vm.hostname="rockyvm"config.vm.network"private_network",type: "dhcp"# Optional: allocate more resourcesconfig.vm.provider"virtualbox"do |vb|
vb.memory=2048vb.cpus=2end# ✅ Use the system Python that supports Ansible 2.12 modules (like dnf)config.vm.provision"ansible"do |ansible|
ansible.compatibility_mode="2.0"ansible.playbook="playbook.yml"ansible.extra_vars={ansible_python_interpreter: "/usr/libexec/platform-python"}endend
✅ Notes
This assumes you've activated your Python 3.10 virtual environment and installed Ansible 2.12:
source~/.venvs/ansible-2.12/bin/activate
ansible --version # should show 2.12.x
platform-python is Rocky 8's internal Python 3.6.8, which works only with Ansible 2.12 or earlier.
✅ Matching playbook.yml Example
---
- hosts: allbecome: truegather_facts: truetasks:
- name: Show which Python is being usedraw: which python3register: python_path
- name: Print Python pathdebug:
var: python_path.stdout
- name: Install chrony using dnf modulednf:
name: chronystate: present
- name: Ensure chronyd is runningservice:
name: chronydstate: startedenabled: yes
The text was updated successfully, but these errors were encountered:
I converted an old Macbook Pro to Linux Mint (Linux Mint 22.1
) and tried to follow the example in Chapter two of your book and ran into a nightmare. After a long chat with ChatGPT:
Here's a summary of our discussion and the key takeaways:
🧵 Problem Summary
You were trying to use Ansible with a Rocky Linux 8 Vagrant VM and ran into these issues:
❌ Ansible failed with:
"MODULE FAILURE: No start of json char found"
This occurred when using modules like
dnf
, indicating broken Python compatibility.❌ Rocky Linux 8 default Python is 3.6 (platform-python), which:
❌ You tried installing Ansible 2.12 (compatible with Python 3.6), but:
_AnsiblePathHookFinder
errors❌ You tried installing Python 3.9 using
apt
, but Mint's base repos didn’t include it✅ Working Solution (Step-by-Step)
🔧 1. Install a compatible Python (3.9 or 3.10) on your host
Using the deadsnakes PPA, you can install Python 3.10 like so:
🐍 2. Create a virtual environment for Ansible 2.12
📦 3. Run Ansible from that environment
This will allow Ansible to run against the Rocky Linux 8 VM using platform-python (3.6) without errors.
Use this in your
Vagrantfile
:And keep your Ansible version at 2.12.x, which supports Python 3.6.
✅ Alternatives you considered:
dnf
bindingsHere's the new working
Vagrantfile
that pairs perfectly with:platform-python
, Python 3.6) on the guest VM — which is fully compatible with Ansible 2.12 for DNF, systemd, etc.✅ Final Working
Vagrantfile
✅ Notes
platform-python
is Rocky 8's internal Python 3.6.8, which works only with Ansible 2.12 or earlier.✅ Matching
playbook.yml
ExampleThe text was updated successfully, but these errors were encountered: