On a Red Hat 8.3 machine I try to use this ansible code:
- debug:
msg: "{{ lookup('dig', 'localhost') }}"
But I get an error:
TASK*****************************************
fatal: [demo.example.com]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'dig'. Error was a <class 'ansible.errors.AnsibleError'>, original message: The dig lookup requires the python 'dnspython' library and it is not installed"}
I think maybe the lookup('dig') doesn't search in the right place...
However I think I do in fact have dnspython installed:
pip3 install dnspython --user
Requirement already satisfied: dnspython in /home/user/.local/lib/python3.6/site-packages
More info:
ansible --version
ansible [core 2.12.7]
python version = 3.8.3