'Ansible /etc not writable even after using become
I can't write to /etc with successful privilege escalation using become. I can however write to it directly from the host so sounds like become isn't behaving as expected.
Playbook (I've omitted other tasks for brevity but all tasks in this playbook require escalation to postgres user and are successful)
- name: Playbook Control
hosts: all
become: yes
become_user: postgres
tasks:
- name: Debug Perms
shell: ls -lrt /etc/pgbackrest.conf
- name: Initialize pgbackrest.conf
copy:
src: pgbackrest_init
dest: /etc/pgbackrest.conf
Inventory
hostname.net
[all:vars]
ansible_connection=ssh
ansible_user=pg_deployment
Playbook Command
ansible-playbook -vvv --vault-password-file=.vault_pw -i hosts/hosts playbook_control.yml
Using vault to store pg_deployment ssh password.
Debug Perms Output
"stdout": "-rw-r--r-- 1 postgres postgres 82 Aug 24 2021 /etc/pgbackrest.conf"
Initialize pgbackrest.conf Output
"msg": "Destination /etc not writable"
In the -vvv block preceding the task Initialize pgbackrest.conf, I see escalation succeeded.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
