I am getting below error while trying to use module postgresql_user. I want 
to create a new user account in postgresql. but i am unable to create user 
account with become_user postgres or commenting that line is failing to get 
authenticate. i have seen a Bug report #4225 but trying to see workaround 
solution.

my playbook contains below code

- name:         Configure Database server ami instance
  hosts:         database
  gather_facts: true
  become:       true
  become_method: sudo
  vars:
    ansible_user: ubuntu
  vars_files:
    - [vars/local_vars.yml]
  roles:
    - postgres

postgres role main.yml

- include: bootstrap.yml

- include: users.yml

# users.yml file task

- name: Create new Administrator User
  postgresql_user:
    name:            "adminuser"
    password:        "adminpwd"
    encrypted:       yes
    state:           present
    role_attr_flags: 
SUPERUSER,CREATEROLE,CREATEUSER,CREATEDB,LOGIN,REPLICATION
  become_user:  postgres

"module_stderr": "Traceback (most recent call last):\n  File 
\"/tmp/ansible_PIv0G9/ansible_module_postgresql_user.py\", line 666, in 
<module>\n    main()\n  File 
\"/tmp/ansible_PIv0G9/ansible_module_postgresql_user.py\", line 627, in 
main\n    changed = user_add(cursor, user, password, role_attr_flags, 
encrypted, expires)\n  File 
\"/tmp/ansible_PIv0G9/ansible_module_postgresql_user.py\", line 220, in 
user_add\n    cursor.execute(query, query_password_data)\n  File 
\"/usr/lib/python2.7/dist-packages/psycopg2/extras.py\", line 123, in 
execute\n    return _cursor.execute(self, query, 
vars)\npsycopg2.ProgrammingError: conflicting or redundant options\n\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE"

Thanks
Shyam

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c63ab831-6715-41ce-b957-3b294412cda3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to