2021-03-10 12:01:32 +01:00
|
|
|
---
|
|
|
|
- name: Install postgresql
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
name: postgresql
|
|
|
|
state: present
|
|
|
|
register: apt_result
|
2021-03-10 12:08:05 +01:00
|
|
|
retries: 3
|
|
|
|
until: apt_result is succeeded
|
2021-03-10 12:01:32 +01:00
|
|
|
|
|
|
|
- name: Ensure main postgresql directory exists
|
|
|
|
file:
|
|
|
|
path: /etc/postgresql/{{ postgresql.version }}/main/
|
|
|
|
state: directory
|
|
|
|
owner: postgres
|
|
|
|
group: postgres
|
|
|
|
mode: 0755
|
2021-03-10 12:10:06 +01:00
|
|
|
recurse: true
|
2021-03-10 12:01:32 +01:00
|
|
|
|
|
|
|
- name: Ensure configuration directory exists
|
|
|
|
file:
|
|
|
|
path: /etc/postgresql/{{ postgresql.version }}/main/conf.d
|
|
|
|
state: directory
|
|
|
|
owner: postgres
|
|
|
|
group: postgres
|
|
|
|
mode: 0755
|
2021-03-10 12:11:02 +01:00
|
|
|
|
2021-03-10 12:01:32 +01:00
|
|
|
- name: Configuration of postgresql {{ postgresql.version }}
|
|
|
|
template:
|
|
|
|
src: postgresql/{{ item }}.j2
|
|
|
|
dest: /etc/postgresql/{{ postgresql.version }}/main/{{ item }}
|
|
|
|
mode: 0640
|
|
|
|
owner: postgres
|
|
|
|
group: postgres
|
|
|
|
loop:
|
|
|
|
- pg_hba.conf
|
|
|
|
- postgresql.conf
|
|
|
|
notify:
|
|
|
|
- restart postgresql
|