Ansible Errors
-
1 min read
While using ansible to install docker in my home lab servers I faced some errors and solved them. Here I document them for future references:
Error related to python
I was using ansible version 2.10 to install docker on ubuntu 24.04 server. I got the following error.
TASK [Gathering Facts] ***************************************************************************************************************
fatal: [alan-laptop]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"failed": true, "module_stderr": "Shared connection to alan-laptop closed.
", "module_stdout": "
Traceback (most recent call last):
File \"/home/alan-sysop/.ansible/tmp/ansible-tmp-1716281784.2385828-132440-85599417152925/AnsiballZ_setup.py\", line 102, in <module>
_ansiballz_main()
File \"/home/alan-sysop/.ansible/tmp/ansible-tmp-1716281784.2385828-132440-85599417152925/AnsiballZ_setup.py\", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/home/alan-sysop/.ansible/tmp/ansible-tmp-1716281784.2385828-132440-85599417152925/AnsiballZ_setup.py\", line 37, in invoke_module
from ansible.module_utils import basic
File \"/tmp/ansible_ansible.legacy.setup_payload_0vjz3har/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py\", line 176, in <module>
ModuleNotFoundError: No module named 'ansible.module_utils.six.moves'
", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: ansible.legacy.setup"}
This was solved by adding ansible_python_interpreter=/usr/bin/python3 in inventory
server details. Also had to update ansible version using pip to 2.17.1 from 2.10.
Error related to locale settings
Got the following error:
$ ansible --version ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1.
Updated /etc/default/locale to following:
LANG=en_US.UTF-8 LANGUAGE="en_IN:en" LC_CTYPE=en_US.UTF-8
Finally executed following command and rebooted:
sudo update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8