Compare commits

..

1 Commits

3 changed files with 17 additions and 3 deletions

View File

@ -2,3 +2,8 @@
PostgreSQL is the self proclaimed "world's most advanced" open source relational
database. This ansible role can deploy and configure postgresql.
## Requirements
- `psycopg2` (pip) package
- `docker` (pip) package

View File

@ -38,12 +38,13 @@
when:
- ansible_facts['service_mgr'] == 'systemd'
- postgresql_state == 'present'
register: postgresql_systemd_tmpfile_correction_unit_info
- name: Ensure systemd is reloaded
ansible.builtin.systemd:
daemon_reload: true
when:
- postgresql_systemd_tmpfile_correction_unit.changed
- postgresql_systemd_tmpfile_correction_unit_info.changed
- name: Ensure systemd unit {{ postgresql_systemd_tmpfile_socket_correction_unit_name }} is {{ postgresql_container_state }}
ansible.builtin.systemd:
@ -57,11 +58,20 @@
enabled: "{{ postgresql_state == 'present' }}"
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
ansible.builtin.include_tasks:
file: "initialize-docker.yml"
when:
- 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
- name: Ensure postgresql container '{{ postgresql_container_name }}' is {{ postgresql_container_state }}

View File

@ -27,7 +27,7 @@
block:
- name: Wait for container startup (socket)
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"
- name: Wait for container startup (port)
ansible.builtin.wait_for:
@ -45,4 +45,3 @@
community.docker.docker_container:
name: "{{ postgresql_container_name }}"
state: absent