Issue #2: More large fixes for later PostgreSQL versions.
This commit is contained in:
parent
dbd07263e0
commit
3cb4aaaa53
|
@ -5,11 +5,13 @@ postgresql_enablerepo: ""
|
|||
postgresql_user: postgres
|
||||
postgresql_group: postgres
|
||||
|
||||
postgresql_unix_socket_dir: /var/run/postgresql
|
||||
postgresql_unix_socket_directories:
|
||||
- /var/run/postgresql
|
||||
|
||||
# Global configuration options that will be set in postgresql.conf.
|
||||
postgresql_global_config_options:
|
||||
- option: unix_socket_directory
|
||||
value: '{{ postgresql_unix_socket_dir }}'
|
||||
- option: unix_socket_directories
|
||||
value: '{{ postgresql_unix_socket_directories | join(",") }}'
|
||||
|
||||
# Debian only. Used to generate the locales used by PostgreSQL databases.
|
||||
postgresql_locales:
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: Configure global settings.
|
||||
lineinfile:
|
||||
dest: "{{ postgresql_config_path }}/postgresql.conf"
|
||||
regexp: "^#?{{ item.option }}.+$"
|
||||
line: "{{ item.option }} = '{{ item.value }}'"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_global_config_options }}"
|
||||
notify: restart postgresql
|
||||
|
||||
- name: Ensure PostgreSQL unix socket dirs exist.
|
||||
file:
|
||||
path: "{{ postgresql_unix_socket_directories }}"
|
||||
state: directory
|
||||
mode: 0777
|
|
@ -9,7 +9,7 @@
|
|||
login_host: "{{ item.login_host | default('localhost') }}"
|
||||
login_password: "{{ item.login_password | default(omit) }}"
|
||||
login_user: "{{ item.login_user | default(postgresql_user) }}"
|
||||
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_dir) }}"
|
||||
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_directories[0]) }}"
|
||||
port: "{{ item.port | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_databases }}"
|
||||
|
|
|
@ -6,21 +6,6 @@
|
|||
mode: 0644
|
||||
notify: restart postgresql
|
||||
|
||||
- name: Configure global settings.
|
||||
lineinfile:
|
||||
dest: "{{ postgresql_config_path }}/postgresql.conf"
|
||||
regexp: "^#?{{ item.option }}.+$"
|
||||
line: "{{ item.option }} = '{{ item.value }}'"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_global_config_options }}"
|
||||
notify: restart postgresql
|
||||
|
||||
- name: Ensure PostgreSQL unix socket dir exists.
|
||||
file:
|
||||
path: "{{ postgresql_unix_socket_dir }}"
|
||||
state: directory
|
||||
mode: 0777
|
||||
|
||||
- name: Ensure PostgreSQL data directory exists.
|
||||
file:
|
||||
path: "{{ postgresql_data_dir }}"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- include: initialize.yml
|
||||
- include: configure.yml
|
||||
|
||||
- name: Ensure PostgreSQL is started and enabled on boot.
|
||||
service:
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
login_host: "{{ item.login_host | default('localhost') }}"
|
||||
login_password: "{{ item.login_password | default(omit) }}"
|
||||
login_user: "{{ item.login_user | default(postgresql_user) }}"
|
||||
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_dir) }}"
|
||||
login_unix_socket: "{{ item.login_unix_socket | default(postgresql_unix_socket_directories[0]) }}"
|
||||
port: "{{ item.port | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
with_items: "{{ postgresql_users }}"
|
||||
# no_log: true
|
||||
no_log: true
|
||||
become: yes
|
||||
become_user: "{{ postgresql_user }}"
|
||||
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Include OS-specific variables (RedHat).
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
include_vars: "{{ ansible_os_family }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Define postgresql_packages.
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
__postgresql_version: "8.4"
|
||||
__postgresql_data_dir: "/var/lib/pgsql/data"
|
||||
__postgresql_bin_path: "/usr/bin"
|
||||
__postgresql_config_path: "/var/lib/pgsql/data"
|
||||
__postgresql_daemon: postgresql
|
||||
__postgresql_packages:
|
||||
- postgresql
|
||||
- postgresql-server
|
||||
- postgresql-contrib
|
||||
- postgresql-libs
|
Loading…
Reference in New Issue