installing postgresql -- permission problem with initdb

211 views
Skip to first unread message

dulh...@mailbox.org

unread,
Oct 17, 2021, 11:47:38 AM10/17/21
to ansible...@googlegroups.com
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?

Dick Visser

unread,
Oct 17, 2021, 1:28:35 PM10/17/21
to ansible...@googlegroups.com
There is a trailing dot, which indicates some SElinux security context. That may prevent your task from completing


  ###################################################################

an anybody advise what I may be missing here?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2145117367.135820.1634485640874%40office.mailbox.org.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

dulh...@mailbox.org

unread,
Oct 18, 2021, 6:04:56 AM10/18/21
to ansible...@googlegroups.com
thx,
As this is an exercise in Ansible and not SELinux I am trying to put selinux to permissive for the time being. This fails via ansible, but even if I do it manually on the target the initdb TASK still does not go through. So I am wondering whether it is something else

here is the full error

Dick Visser

unread,
Oct 18, 2021, 10:37:34 AM10/18/21
to ansible...@googlegroups.com
This proves there is some permissions issue. 
So best to solve that and make initdb work manually, and then ansiblize the process. 


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages