A
A
Anton2018-11-28 09:01:10
PostgreSQL
Anton, 2018-11-28 09:01:10

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

2 answer(s)
S
Sanes, 2018-11-28
@Sanes

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'

P
Puma Thailand, 2018-11-28
@opium

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 question

Ask a Question

731 491 924 answers to any question