Error message when running playbook

I’m in the process of rebuilding my main workstation, and as part of that rebuild, I would like to run one of my playbooks.

However, when I do, I get this error message:

TASK [Gathering Facts] ************************************************************************************************************************************************
fatal: [mikelaptop]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "failed": true, "module_stderr": "Shared connection to 192.168.1.11 closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/mdiehl/.ansible/tmp/ansible-tmp-1745284382.6440313-1854975-177535314737957/AnsiballZ_setup.py\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/mdiehl/.ansible/tmp/ansible-tmp-1745284382.6440313-1854975-177535314737957/AnsiballZ_setup.py\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/mdiehl/.ansible/tmp/ansible-tmp-1745284382.6440313-1854975-177535314737957/AnsiballZ_setup.py\", line 37, in invoke_module\r\n    from ansible.module_utils import basic\r\n  File \"/tmp/ansible_ansible.legacy.setup_payload_v6ehjd8k/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py\", line 176, in <module>\r\nModuleNotFoundError: No module named 'ansible.module_utils.six.moves'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}
``

Note that the laptop in question is new as well.  (Not ideal, I know.)

Here is one of many playbooks that I need to run, but return the error message from above:

``$ cat users.yml 
- name: Create and setup user accounts
  hosts: home
  vars_files:
    - ./Vars/Users.yml

  tasks:
  - name: Create users
    ansible.builtin.user:
      name: "{{ item.name }}"
      generate_ssh_key: yes
      state: present
      groups:
        - games
        - sudo
    loop: "{{ Users }}
``
This was all working before I had to recover from backup, so I don't know where to begin to troubleshoot this.

Mike

It looks to be an issue with your Ansible version?

There is also this comment, from a decade ago… that suggests:

pip install six
1 Like

It looks like a broken install. Check if you’re using a version of ansible-core that supports the Python version on the control node: Releases and maintenance — Ansible Community Documentation. Run the playbook with -vv to check the intended version of Python is executing ansible-playbook (it will be at the top of the output) in case there are multiple Python versions installed.

2 Likes

I ended up blowing the system away and starting over. It was a new install, so I didn’t lose anything.

After that, it worked as expected.

Thanks for your time.

Mike.