Compare commits
1 Commits
40d9c9bdd5
...
edf40eb375
Author | SHA1 | Date | |
---|---|---|---|
edf40eb375 |
@ -2,8 +2,3 @@
|
|||||||
|
|
||||||
PostgreSQL is the self proclaimed "world's most advanced" open source relational
|
PostgreSQL is the self proclaimed "world's most advanced" open source relational
|
||||||
database. This ansible role can deploy and configure postgresql.
|
database. This ansible role can deploy and configure postgresql.
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- `psycopg2` (pip) package
|
|
||||||
- `docker` (pip) package
|
|
||||||
|
@ -38,13 +38,12 @@
|
|||||||
when:
|
when:
|
||||||
- ansible_facts['service_mgr'] == 'systemd'
|
- ansible_facts['service_mgr'] == 'systemd'
|
||||||
- postgresql_state == 'present'
|
- postgresql_state == 'present'
|
||||||
register: postgresql_systemd_tmpfile_correction_unit_info
|
|
||||||
|
|
||||||
- name: Ensure systemd is reloaded
|
- name: Ensure systemd is reloaded
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
when:
|
when:
|
||||||
- postgresql_systemd_tmpfile_correction_unit_info.changed
|
- postgresql_systemd_tmpfile_correction_unit.changed
|
||||||
|
|
||||||
- name: Ensure systemd unit {{ postgresql_systemd_tmpfile_socket_correction_unit_name }} is {{ postgresql_container_state }}
|
- name: Ensure systemd unit {{ postgresql_systemd_tmpfile_socket_correction_unit_name }} is {{ postgresql_container_state }}
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
@ -58,20 +57,11 @@
|
|||||||
enabled: "{{ postgresql_state == 'present' }}"
|
enabled: "{{ postgresql_state == 'present' }}"
|
||||||
when: ansible_facts['service_mgr'] == 'systemd'
|
when: ansible_facts['service_mgr'] == 'systemd'
|
||||||
|
|
||||||
- name: Lookup {{ postgresql_data_path }}/global
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: "{{ postgresql_data_path }}/global"
|
|
||||||
get_checksum: false
|
|
||||||
register: postgresql_global_data_info
|
|
||||||
|
|
||||||
- name: Initialize database if empty
|
- name: Initialize database if empty
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: "initialize-docker.yml"
|
file: "initialize-docker.yml"
|
||||||
when:
|
when:
|
||||||
- postgresql_state == 'present'
|
- postgresql_state == 'present'
|
||||||
- postgresql_global_data_info.stat.exists
|
|
||||||
- postgresql_global_data_info.stat.isdir is defined
|
|
||||||
- postgresql_global_data_info.stat.isdir
|
|
||||||
# TODO: determine if initialization is needed
|
# TODO: determine if initialization is needed
|
||||||
|
|
||||||
- name: Ensure postgresql container '{{ postgresql_container_name }}' is {{ postgresql_container_state }}
|
- name: Ensure postgresql container '{{ postgresql_container_name }}' is {{ postgresql_container_state }}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
block:
|
block:
|
||||||
- name: Wait for container startup (socket)
|
- name: Wait for container startup (socket)
|
||||||
ansible.builtin.wait_for:
|
ansible.builtin.wait_for:
|
||||||
path: "{{ postgresql_config_unix_socket_directories | first }}/.s.PGSQL.{{ postgresql_config_port }}"
|
path: "{{ postgresql_config_unix_socket_directories | first }}.s.PGSQL.{{ postgresql_config_port }}"
|
||||||
when: "postgresql_config_connect_socket | bool"
|
when: "postgresql_config_connect_socket | bool"
|
||||||
- name: Wait for container startup (port)
|
- name: Wait for container startup (port)
|
||||||
ansible.builtin.wait_for:
|
ansible.builtin.wait_for:
|
||||||
@ -45,3 +45,4 @@
|
|||||||
community.docker.docker_container:
|
community.docker.docker_container:
|
||||||
name: "{{ postgresql_container_name }}"
|
name: "{{ postgresql_container_name }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user