Initial commit
This commit is contained in:
commit
f08cc8b541
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"*.yml": "ansible"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
psql_users: []
|
||||
psql_databases: []
|
||||
psql_privileges: []
|
|
@ -0,0 +1,4 @@
|
|||
galaxy_info:
|
||||
role_name: postgeresql
|
||||
|
||||
dependencies: []
|
|
@ -0,0 +1,44 @@
|
|||
- name: Install packages.
|
||||
tags: postgresql
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- postgresql
|
||||
- postgresql-client
|
||||
- python3-psycopg2
|
||||
|
||||
- name: Create databases.
|
||||
become: true
|
||||
become_user: postgres
|
||||
tags: postgresql
|
||||
community.postgresql.postgresql_db:
|
||||
encoding: "{{ item.encoding | default('utf8') }}"
|
||||
target: "{{ item.target | default(omit) }}"
|
||||
name: "{{ item.name }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ psql_databases }}"
|
||||
|
||||
- name: Create database users.
|
||||
become: true
|
||||
become_user: postgres
|
||||
tags: postgresql
|
||||
community.postgresql.postgresql_user:
|
||||
name: "{{ item.name }}"
|
||||
host: "{{ item.host | default(omit) }}"
|
||||
password: "{{ item.password | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ psql_users }}"
|
||||
|
||||
- name: Create database privileges
|
||||
become: true
|
||||
become_user: postgres
|
||||
tags: postgresql
|
||||
community.postgresql.postgresql_privs:
|
||||
db: "{{ item.db | default(omit) }}"
|
||||
privs: "{{ item.privs | default('SELECT,INSERT,UPDATE') }}"
|
||||
objs: "{{ item.objs }}"
|
||||
type: "{{ item.type | default(omit) }}"
|
||||
database: "{{ item.database | default(omit) }}"
|
||||
roles: "{{ item.roles }}"
|
||||
grant_option: "{{ item.grant_option | default('yes') }}"
|
||||
with_items: "{{ psql_privileges }}"
|
Loading…
Reference in New Issue