Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a python warning when running playbook EC2 inventory

I am really new to Ansible and I hate getting warnings when I run a playbook. This environment is being used for my education.

Environment:

  • AWS EC2
  • 4 Ubuntu 20
  • 3 Amazon Linux2 hosts

Inventory

  • using the dynamic inventory script

playbook

  • just runs a simple ping against all hosts. I wanted to test the inventory

warning

  • [WARNING]: Platform linux on host XXXXXX.amazonaws.com is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-core/2.11/reference_appendices/interpreter_discovery.html for more information.

Things I have tried

  • updated all sym links on hosts to point to the python3 version
  • adding the line "ansible_python_interpreter = /usr/bin/python" to "/etc/ansible/ansible.cfg"
  • I am relying on that cfg file

I would like to know how to solve this. since I am not running a static inventory, I didn't think that I could specific an interpreter on a per host or group of hosts. While the playbook runs, it seems that something is not configured correctly and I would like to get that sorted. This is only present on the Amazon Linux instances. the Ubuntu instances are fine.

Michael

like image 784
M.Ford Avatar asked Dec 12 '25 18:12

M.Ford


1 Answers

You can edit your ansible.cfg and set auto_silent mode:

interpreter_python=auto_silent  

Check reference here: https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html

like image 197
ikora Avatar answered Dec 14 '25 22:12

ikora



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!