Usually I do :
sudo -su postgres
psql
\password
\q
to change postgres password. Now I want to automate this step using ansible.
Ansible postgresql_user module will help to set/reset the database user password. Here is the sample
- name: pd reset database user
become: yes
become_method: sudo
become_user: postgres
postgresql_user:
db: test
name: test
password: ""
For Reference, here is ansible link: https://docs.ansible.com/ansible/latest/collections/community/postgresql/postgresql_user_module.html#ansible-collections-community-postgresql-postgresql-user-module