Files
tildes/ansible/roles/postgresql/tasks/main.yml
T
2025-03-10 22:49:00 -06:00

37 lines
980 B
YAML

---
- name: Install PostgreSQL
apt:
name: postgresql-{{ postgresql_version }}
- name: Remove postgresql from init.d (may conflict with systemd service)
file:
path: /etc/init.d/postgresql
state: absent
when: is_docker
- name: Update rc.d to reflect init.d removal
command:
cmd: update-rc.d postgresql remove
when: is_docker
- name: Start and enable PostgreSQL meta unit service
systemd_service:
name: postgresql
state: started
enabled: true
- name: Start and enable PostgreSQL cluster service
systemd_service:
name: postgresql@{{ postgresql_version }}-main
state: started
enabled: true
- name: Set configuration options in postgresql.conf
lineinfile:
path: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
regexp: "^#?{{ item.key }} ?="
line: "{{ item.key }} = {{ item.value }}"
loop: "{{ _postgresql_settings | combine(postgresql_settings) | dict2items }}"
notify:
- Restart postgresql