Issue #8679
closedAnsible install fails on RHEL 7.9 at SCL PostgreSQL 10 initialization
Description
Hello,
Following the documentation at https://pulpproject.org/ansible-installer/ to install on a RHEL 7.9 Server system and now at this stage:
ansible-playbook playbooks/example-use/playbook.yml -u <managed_node_username> --ask-become-pass
This fails with the following message:
TASK [geerlingguy.postgresql : Ensure PostgreSQL database is initialized.] ***********************************************************************************************************************************************************************
fatal: [vmpulptest]: FAILED! => {"changed": true, "cmd": ["/opt/rh/rh-postgresql10/root/bin/initdb", "-D", "/var/opt/rh/rh-postgresql10/lib/pgsql/data"], "delta": "0:00:00.038178", "end": "2021-04-30 15:03:02.111454", "msg": "non-zero return code", "rc": 127, "start": "2021-04-30 15:03:02.073276", "stderr": "/opt/rh/rh-postgresql10/root/bin/initdb: error while loading shared libraries: libpq.so.rh-postgresql10-5: cannot open shared object file: No such file or directory", "stderr_lines": ["/opt/rh/rh-postgresql10/root/bin/initdb: error while loading shared libraries: libpq.so.rh-postgresql10-5: cannot open shared object file: No such file or directory"], "stdout": "", "stdout_lines": []}
Looking at the code, it looks like these vars in pulp_installer/roles/pulp_database/vars/RedHat-7.yml force using the SCL packages of PostgreSQL 10. I tried enabling the SCL before running the Ansible playbook with
source scl_source enable rh-postgresql10
and it still fails with the same error message. My best guess is that the become: forcing Ansible to sudo as user 'postgres' doesn't pass the environment variables initialized by the SCL.
Maybe a chicken-and-egg problem? I ended up using this to manually work around the issue:
[root@vmpulptest ~]# scl enable rh-postgresql10 -- sudo -u postgres bash
then
[postgres@vmpulptest ~]$ /opt/rh/rh-postgresql10/root/bin/initdb -D /var/opt/rh/rh-postgresql10/lib/pgsql/data
After this, the rest of playbooks/example-use/playbook.yml went just fine.
Thanks!
Related issues