I have a task to create an initial postgres databa (initdb) in a playbook installing postgresql from a tar.gz archive on a centos7 target
###################################################################
- name: configure postgres - create database
command:/opt/db/postgres/postgresql/src/bin/initdb -D /opt/db/data/postgres/data
args:
creates: /opt/db/data/postgres/PG_VERSION"
become: yes
become_user: postgres
###################################################################
playbook execution throws the following error at me:
###################################################################
TASK [configure postgres - create database] **************************************************
fatal: [vm-0179]: FAILED! => changed=false
cmd: /opt/db/postgres/postgresql/src/bin/initdb -D /opt/db/data/postgres/data
msg: '[Errno 13] Permission denied'
rc: 13
###################################################################
I read this as the user running that task (postgres) may not have rw permissions to the parent directory
however this indicates somethin else
###################################################################
> ls -l /opt/db/data/postgres/
drwxr-x---. 2 postgres postgres 6 14. Okt 10:34 data
###################################################################
an anybody advise what I may be missing here?