2016-09-29 16:03:13 +00:00
|
|
|
---
|
2018-10-01 01:23:32 +00:00
|
|
|
- name: Converge
|
|
|
|
hosts: all
|
|
|
|
become: true
|
2016-09-29 16:03:13 +00:00
|
|
|
|
2016-09-29 19:33:39 +00:00
|
|
|
vars:
|
|
|
|
postgresql_databases:
|
|
|
|
- name: example
|
|
|
|
postgresql_users:
|
|
|
|
- name: jdoe
|
|
|
|
|
2016-09-29 16:03:13 +00:00
|
|
|
pre_tasks:
|
2019-08-07 15:07:11 +00:00
|
|
|
# The Fedora 30+ container images have only C.UTF-8 installed
|
|
|
|
- name: Set database locale if using Fedora 30+
|
|
|
|
set_fact:
|
|
|
|
postgresql_databases:
|
|
|
|
- name: example
|
|
|
|
lc_collate: 'C.UTF-8'
|
|
|
|
lc_ctype: 'C.UTF-8'
|
|
|
|
when:
|
|
|
|
- ansible_distribution == 'Fedora'
|
|
|
|
- ansible_distribution_major_version >= '30'
|
|
|
|
|
2016-09-29 16:03:13 +00:00
|
|
|
- name: Update apt cache.
|
2018-10-01 01:23:32 +00:00
|
|
|
apt: update_cache=true cache_valid_time=600
|
2016-09-29 16:03:13 +00:00
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
2017-06-02 21:57:37 +00:00
|
|
|
- name: Set custom variables for old CentOS 6 PostgreSQL install.
|
2016-09-30 04:11:03 +00:00
|
|
|
set_fact:
|
2017-06-02 21:57:37 +00:00
|
|
|
postgresql_hba_entries: []
|
2016-09-30 04:11:03 +00:00
|
|
|
postgresql_global_config_options:
|
|
|
|
- option: unix_socket_directory
|
|
|
|
value: '{{ postgresql_unix_socket_directories[0] }}'
|
2018-10-01 01:23:32 +00:00
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_distribution_version.split('.')[0] == '6'
|
2016-09-30 04:11:03 +00:00
|
|
|
|
2016-09-29 16:03:13 +00:00
|
|
|
roles:
|
2018-10-01 01:23:32 +00:00
|
|
|
- role: geerlingguy.postgresql
|
|
|
|
|
|
|
|
post_tasks:
|
|
|
|
- name: Verify postgres is running.
|
|
|
|
command: "{{ postgresql_bin_path }}/pg_ctl -D {{ postgresql_data_dir }} status"
|
|
|
|
changed_when: false
|
2018-10-01 01:42:29 +00:00
|
|
|
become: true
|
|
|
|
become_user: postgres
|