blob: 8a18bf2018f0ee57cb4b84c2983b73b8a31fc605 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
- name: Install postgres packages.
apt:
name:
- python3-psycopg2
- postgresql-{{ postgresql_version }}
- postgresql-contrib-{{ postgresql_version }}
- libpq-dev
state: present
- name: Check postgres is started and enabled on boot.
service:
name: '{{ postgresql_daemon }}'
state: started
enabled: true
- name: Add postgres users.
community.postgresql.postgresql_user:
name: "{{ item.name }}"
login_user: "{{ item.login_user }}"
role_attr_flags: "{{ item.role_attr_flags }}"
with_items: "{{ postgresql_users }}"
become: true
become_user: "{{ postgresql_user }}"
- name: Add postgres databases.
community.postgresql.postgresql_db:
name: "{{ item.name }}"
owner: "{{ item.owner | default(postgresql_user) }}"
with_items: "{{ postgresql_databases }}"
become: true
become_user: "{{ postgresql_user }}"
|