1

I updated a recent playbook module that says I need to use at least Python version 3.8. I run this playbook on our AWX controller. When I run the cmd module and do a "which python3" I get back version 3.6 in /var/lib/awx/venv/ansible/bin/python3. I tried doing a pre_task to install python3.9 using the yum module, and I see in the output that it gets installed.

I thought I could use the "var: ansible_python_interpreter: path but I need to find out where new versions of python get installed. Do you know where python gets installed within the AWX controller when running a playbook to install it?

---
- name: Test commands
  hosts: localhost
  connection: local
  gather_facts: false

  pre_tasks:
    - name: install Python 
      ansible.builtin.yum:
        name: python3.9
        state: present
      become: yes
      delegate_to: localhost  
      

- name: Configure Avi Controller
  hosts: localhost
  connection: local
  collections:
    - cyberark.pas
    - vmware.alb
  vars:
    ansible_python_interpreter: /var/lib/awx/venv/ansible/bin/python3.9
  tasks:

When I run this I get "/var/lib/awx/venv/ansible/bin/python3.9 file or directory does not exist"

1 Answer 1

1

AWX is running in a docker container, isn't it?

If you make a venv on your ansible controller with python3.9 it still won't be functional. To get this to work, you will have to add your actual host (which seems insecure ) to your inventory and have a method to log on to it.

The best way around this, that I can think of, would be to upgrade python on your docker container running AWX, probably don't need a venv on the container, but that might be best practice.


Also, hosts: localhost implies connection: local so that part is redundant, unless there's a reason it's not (like a global variable setting connection: ssh)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.