Anaconda version during OS install

Hi all,

was wondering if during an OS install the anaconda version can be changed and how?

Currently i am able to install via text python3.11 up in the package section but OS instalation i believe runs anaconda with python3.6, which blocks me from running ansible-core as it needs version 3.11

Many thanks.

The install images are created to run whatever anaconda the distro has, i.e. what corresponding RHEL has.
The el8 has python3.6 as “platform python” (el9 has 3.9), so that is in the image to support the image.

Your package list has added packages ansible-core and python3.11 to the new system,
but the question is, what can/will be used by commands that run in the %post section?


It is possible to tell Ansible what to use in the remote machine via ansible_python_interpreter,
However, I do use /usr/libexec/platform-python in that, so el8 target is happy with python3.6.

The scripts ansible, ansible-playbook, and ansible-core do all start in el8 with:

#!/usr/bin/python3.11

On el9 they start with: #!/usr/bin/python3 i.e. are happy with 3.9.


Can the %post be told to chroot (or something) so that the /usr in the environment will point to correct path?

EDIT: The %post seems to chroot by default. Why that is not enough for Ansible?

what can/will be used by commands that run in the %post section?

In my case i do the following:

%post --nochroot --interpreter=/mnt/sysimage/bin/python3.11 --log=/root/ansible-post.log
ansible-galaxy install -r /mnt/sysimage/opt/ansible-site/requirements.yml

But this gives an error as the process states:

/mnt/sysimage/bin/python3.11 error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory

I’m still missing a lot to learn about custom installs and don’t find docu easily. But for my work i need to install and set ansible from USB not from a remote machine.

Hope someone can guide a bit arround this issue.

So you explicitly don’t use chroot. Perhaps: redhat - Execute half of the %post section of a kickstart in a nochroot environment and the other half in a chroot environment - Server Fault

I.e. something like:

%post --nochroot --log=/root/ansible-post.log
chroot /mnt/sysimage/ /usr/bin/ansible-galaxy install -r /opt/ansible-site/requirements.yml

Or simply:

%post
/usr/bin/ansible-galaxy install -r /opt/ansible-site/requirements.yml

Note also that EPEL has package ansible that is a collection of some roles. If you can install that package and if it fulfills your requirements, then you won’t need to call ansible-galaxy at all.

I have decided to set a script outside of the install to be runned on first boot, that way the script can use python3.9, but my problem comes when the files dissapear after the install ends once the server gets restarted. Also the systemctl service i declare at the kickstart will not work after the reboot. Got no clue on how to make this work out.