32 lines
881 B
YAML
32 lines
881 B
YAML
- name: install "postgres"
|
|
become: yes
|
|
apt:
|
|
name: "{{ postgres_programme }}"
|
|
state: present
|
|
update_cache: yes
|
|
cache_valid_time: 1800 #https://stackoverflow.com/questions/41535838/how-to-run-apt-update-and-upgrade-via-ansible-shell
|
|
|
|
- name: install "setfacl support"
|
|
become: yes
|
|
apt:
|
|
name: acl
|
|
|
|
- name: Create database
|
|
become: true
|
|
become_user: postgres
|
|
postgresql_db:
|
|
name: "{{ item.name_db }}"
|
|
loop: "{{ postgres_user_and_db }}"
|
|
no_log: true
|
|
|
|
- name: Connect to database, create users and grant access to database
|
|
become: true
|
|
become_user: postgres
|
|
postgresql_user:
|
|
db: "{{ item.name_db }}"
|
|
name: "{{ item.name_db_user }}"
|
|
password: "{{ item.password_db_user }}"
|
|
priv: "ALL"
|
|
role_attr_flags: SUPERUSER
|
|
no_log: true
|
|
loop: "{{ postgres_user_and_db }}"
|