ansible-role-postgresql/tasks/main.yml

27 lines
528 B
YAML

- name: DB - Install PostgreSQL
package:
name:
- postgresql
- python-psycopg2
- postgresql-old-upgrade
- postgis
- name: DB - Ensure a locale exists
locale_gen:
name: en_US.UTF-8
state: present
- name: DB - Init
become: yes
become_user: postgres
become_method: su
command: initdb --locale=en_US.UTF-8 -E UTF8 -D /var/lib/postgres/data
args:
creates: /var/lib/postgres/data/postgresql.conf
- name: DB - starting
systemd:
name: postgresql
enabled: yes
state: started