postgresql icon indicating copy to clipboard operation
postgresql copied to clipboard

Failing at the check users step

Open maxpearl opened this issue 6 years ago • 5 comments

I've got a very simple test setup, and I'm getting this error:

TASK [ANXS.postgresql : PostgreSQL | Make sure the PostgreSQL users are present] *** fatal: [default]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}

This is on a vagrant debian stretch virtualbox

The user and database in vars don't get created.

Here's the playbook:

---
- hosts: all
  remote_user: root
  become: yes
  vars_files:
  - ./vars.yml
  roles:
  - { role: ANXS.postgresql, no_log: False }

And here are the vars:

postgresql_version: 9.6
postgresql_port: 5432

postgresql_databases:
  - name: testing
    owner: test

postgresql_users:
  - name: test

maxpearl avatar Dec 05 '19 00:12 maxpearl

Also tried with postgresql 11, same error.

maxpearl avatar Dec 05 '19 00:12 maxpearl

My guess is that you need to have the pip package psycopg2 installed to be able to create users, as documented here. I did this through a pre_task:

- hosts: db
  become: yes
  
  pre_tasks:
    - name: Install psycopg2 for ansible to be able to create postgresql users
      pip: name=psycopg2-binary
      become: yes
      
  roles:
    - { role: ANXS.postgresql }

mike1o1 avatar Dec 14 '19 07:12 mike1o1

I installed psycopg2 using Debian's python-psycopg2 package in a pre-task. So perhaps the pip installation would be preferable. But in either event (a missing psycopg2 package, or one that doesn't match what's required) should throw a more specific error, no?

maxpearl avatar Dec 14 '19 19:12 maxpearl

My guess is that you need to have the pip package psycopg2 installed to be able to create users, as documented here. I did this through a pre_task:

- hosts: db
  become: yes
  
  pre_tasks:
    - name: Install psycopg2 for ansible to be able to create postgresql users
      pip: name=psycopg2-binary
      become: yes
      
  roles:
    - { role: ANXS.postgresql }

This worked for me, I just added the install pip3 task:

  pre_tasks:
    - name: install pip3
      become: yes
      apt: name=python3-pip state=present update_cache=true
    - name: Install psycopg2 for ansible to be able to create postgresql users
      become: yes
      pip: name=psycopg2-binary

EDIT: I'm using vagrant init ubuntu/bionic64, which resolves to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-117-generic x86_64).

aesyondu avatar Sep 23 '20 01:09 aesyondu

issue still persists after pre_tasks set to the above

make sure you have ACL package installed

https://github.com/georchestra/ansible/issues/55

jessequinn avatar Nov 18 '21 16:11 jessequinn

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

github-actions[bot] avatar Dec 21 '23 23:12 github-actions[bot]

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

github-actions[bot] avatar Feb 20 '24 23:02 github-actions[bot]