Closed europ closed 3 years ago
The examples you propose does not need become: true
, as that is dealt with inside the role already.
The become is truly necessary otherwise some tasks will fail. Your example does include the become as well.
PLAY [container] **************************************************************************************
TASK [Gathering Facts] ********************************************************************************
ok: [172.17.0.2]
TASK [ANXS.postgresql : include_vars] *****************************************************************
ok: [172.17.0.2] => (item=/home/username/.ansible/roles/ANXS.postgresql/vars/../vars/RedHat.yml)
TASK [ANXS.postgresql : PostgreSQL | Make sure the CA certificates are available | apt] ***************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | Add PostgreSQL repository apt-key | apt] *************************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | Add PostgreSQL repository | apt] *********************************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | Add PostgreSQL repository preferences | apt] *********************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | Make sure the dependencies are installed | apt] ******************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | Install PostgreSQL | apt] ****************************************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | PGTune | apt] ****************************************************
skipping: [172.17.0.2]
TASK [ANXS.postgresql : PostgreSQL | Install all the required dependencies | yum] *********************
fatal: [172.17.0.2]: FAILED! => {"changed": false, "changes": {"installed": ["python-psycopg2","epel-re
lease", "libselinux-python"]}, "msg": "ovl: Error while doing RPMdb copy-up:\n[Errno 13] Permission den
ied: '/var/lib/rpm/Dirnames'\nYou need to be root to perform this command.\n", "rc": 1, "results": ["ca
-certificates-2020.2.41-70.0.el7_8.noarch providing ca-certificates is already installed", "python-pycu
rl-7.19.0-19.el7.x86_64 providing python-pycurl is already installed", "glibc-common-2.17-323.el7_9.x86
_64 providing glibc-common is already installed", "Loaded plugins: fastestmirror, ovl\n"]}
PLAY RECAP ********************************************************************************************
172.17.0.2 : ok=2 changed=0 unreachable=0 failed=1 skipped=7 rescued=0 ignored=0
I do not see any become: true
near by tasks that are installing packages, e.g.:
https://github.com/ANXS/postgresql/blob/fdadb50b4ad642fe87ed80b13de8ad7260d41457/tasks/install_yum.yml#L6-L11
I agree now after reading through the role. The become: true
statements in the role all have become_user: "{{postgresql_admin_user}}"
.