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 \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