Closed gclough closed 5 years ago
I'm pretty new to ansible and maybe doing something wrong but I have error in this task:
TASK [postgresql : PostgreSQL | Check binary version] ******************************************************************************************************************************************************************************************************** fatal: [db0]: FAILED! => {"msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: chown: changing ownership of '/var/tmp/ansible-tmp-1553254977.9908254-74222247871288/': Operation not permitted\nchown: changing ownership of '/var/tmp/ansible-tmp-1553254977.9908254-74222247871288/AnsiballZ_command.py': Operation not permitted\n}). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}
My playbook:
- hosts: db
become: yes
vars_files:
- ./pg_vars.yml
roles:
- postgresql
Check Binary/Database versions match, otherwise restart. This can happen when something has upgraded the PostgreSQL binaries, but the cluster hasn't been restarted. (Like what happened to me when the Ansible play failed half way through after a network error).
This tests allows the role to be more idempotent, and if you upgrade but fail to restart... then the next time it will detect that fact and call the restart handler.