I need to install Python 3.9 on RHEL 7 system ( about 10 servers in each environment ) and then update / install Ansible 2.11 on the system. This is in preparation to upgrade Confluent version on these servers. I understand, on RHEL 7, we have to keep python 2 as it is used by OS. Currently, we have Python2 and Ansible 2.9.27 on the host server in the other non-sandbox environments.

On my sandbox servers, as a POC, I installed Python 3.9 manually using these install steps and then installed Ansible 2.11 ( using python3 -m pip install ansible==4.10.0 )

But in the non-sandbox environments, I want to try and do this using Ansible playbook, if possible.

I can try to create a playbook and add the steps from the above document to Ansible shell or command module, but my concern / question is - is it possible to instal Python 3.9 and install / upgrade Ansible to version 2.11 where currently my Ansible is 2.9.27 and Python is Python 2? Or is there a better way to automate these 2 installs / upgrades on all of confluent servers in the different environments?

Can someone provide some guidance on this? Or am I stuck doing both of these manually ?

Thank you

  • This is what RHEL software collections is intended for, but RHEL 7 is really old - 3 years passed its "full support" period. If I were to automate this, I would probably lean towards building an RPM to distribute.
    – jordanm
    Nov 15, 2023 at 21:01
  • Thanks. But I am not a unix guru - I have learnt just enough to get these things working, with help of other unix team members in the organization. I am basically more of a software engineer / application developer than a systems administrator. So, don't know how to go about building an RPM either. And I realize RHEL 7 is out of support - but that is the limitation I have to work with. Is it easier to build an RPM ? Thanks
    – adbdkb
    Nov 15, 2023 at 21:11
  • I am a big proponent of automation, but if you're talking about only 9 servers that will be forced to be replaced within a couple years... I would consider doing to manually. Generally this is the time to push the org to replace the servers now, as this tech debt is already making forward progress more difficult and eventual replacement is inevitable. Python 3.8 was the latest red hat created for RHEL 7 in software collections.
    – jordanm
    Nov 15, 2023 at 21:18
  • Thanks for the response. But, it is 9 servers in just dev env, 9 in QA, 10 in UAT and 11 each in Prod and DR.
    – adbdkb
    Nov 15, 2023 at 21:38

1 Answer 1


I agree with Jordan on creating a local distro. Documentation for creating the repo can be found all over but the exact steps will depend on your topology. This syntax may be off as I just hand jammed real quick. Once the repo is fully set up, this is a simple playbook to mount the remote repo and then upgrade specified packages.

- hosts: [host list]
  become: true
        - name: Mount Repo
                  path: /path/to/repo
                  src: [IP of repo host]:/repo
                  state: mounted
                  opts: defaults,option,option,option
                  fstype: nfs

        - name: run upgrade
                  name: "*" #or name: "python.x86_64"
                  state: latest
                  skip_broken: true

name: "*" will update ANY package that is needed from your repo, or you can specify exactly what package you want. The "python.x86_64" will just be replaced with whatever your specific packages are named.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .