2020-07-22 19:51:50 +02:00
|
|
|
- name: Install PostgreSQL
|
2020-07-21 02:29:22 +02:00
|
|
|
package:
|
2020-07-22 19:51:50 +02:00
|
|
|
state: latest
|
2020-07-21 02:29:22 +02:00
|
|
|
name:
|
|
|
|
- postgresql
|
2020-07-22 19:51:50 +02:00
|
|
|
- python-psycopg2
|
|
|
|
- postgresql-old-upgrade
|
|
|
|
- postgis
|
2020-07-22 16:06:30 +02:00
|
|
|
|
2020-07-22 19:51:50 +02:00
|
|
|
- name: Ensure a locale exists
|
|
|
|
locale_gen:
|
|
|
|
name: en_US.UTF-8
|
|
|
|
state: present
|
2020-07-22 16:06:30 +02:00
|
|
|
|
2020-07-22 19:51:50 +02:00
|
|
|
- name: init db
|
|
|
|
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
|
2020-07-22 16:06:30 +02:00
|
|
|
|
2020-07-22 19:51:50 +02:00
|
|
|
- name: start db
|
|
|
|
systemd:
|
|
|
|
name: postgresql
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
|
|
|
|
- name: create db user
|
|
|
|
postgresql_user:
|
|
|
|
login_host: "{{ mailserver_db_host }}"
|
|
|
|
name: "{{ mailserver_db_user }}"
|
|
|
|
password: "{{ mailserver_db_password }}"
|
|
|
|
|
|
|
|
- name: create db
|
|
|
|
postgresql_db:
|
|
|
|
login_host: "{{ mailserver_db_host }}"
|
|
|
|
name: "{{ mailserver_db_name }}"
|
|
|
|
owner: "{{ mailserver_db_user }}"
|
|
|
|
encoding: UTF-8
|
|
|
|
lc_collate: en_US.UTF-8
|
|
|
|
lc_ctype: en_US.UTF-8
|