ANXS / postgresql

Fairly full featured Ansible role for Postgresql.
http://anxs.io/
MIT License
849 stars 573 forks source link

Failing at the check users step #458

Closed maxpearl closed 6 months ago

maxpearl commented 4 years ago

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 commented 4 years ago

Also tried with postgresql 11, same error.

mike1o1 commented 4 years ago

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 }
maxpearl commented 4 years ago

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?

aesyondu commented 3 years ago

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).

jessequinn commented 2 years ago

issue still persists after pre_tasks set to the above

make sure you have ACL package installed

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

github-actions[bot] commented 8 months ago

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] commented 6 months ago

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.