Answer the question
In order to leave comments, you need to log in
What is the best ansible role to use to create only databases and users in PostgreSQL without applying other settings?
I have a PostgreSQL cluster.
What is the best ansible role to use to create only databases and users in PostgreSQL without applying other settings?
Without applying the rest of the settings is very important because the settings are applied in another config.
There are a lot of bases, a lot of users.
I thought to take a ready-made ansible-role, remove everything unnecessary, enter all users and database in default/main.yaml and apply
Answer the question
In order to leave comments, you need to log in
And what exactly is the difficulty? It's a 10 line playbook. At least for MySQL.
###
- name: 'Pwgen MySQL User Password'
command: pwgen 12 1
register: mysql_user_pass
- name: 'Add MySQL DB'
mysql_db: 'name={{ username }} encoding=utf8 login_user=root login_password={{ mysql_root_pass }} state=present'
- name: 'Add MySQL user'
mysql_user: 'name={{ username }} password={{ mysql_user_pass.stdout }} priv={{ username }}.*:ALL login_user=root login_password={{ mysql_root_pass }} state=present'
so in ansible there is a standard module for
postgres postgresql_user: name=34567gnek3u
password=akper6n7o8l76n5e4k
role_attr_flags=REPLICATION
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question