ndon't initialize and configure standby database

This commit is contained in:
vincent 2024-05-08 21:11:39 +02:00
parent 2d1ae51136
commit 25c7779d91
2 changed files with 6 additions and 3 deletions

View File

@ -21,7 +21,8 @@
- name: Ensure PostgreSQL database is initialized.
command: "{{ postgresql_bin_path }}/initdb -D {{ postgresql_data_dir }} --locale=C.UTF-8 --encoding=UTF8 --data-checksums"
when: not pgdata_dir_version.stat.exists
when: not pgdata_dir_version.stat.exists and (postgres_consul_tag is not defined or postgres_consul_tag == "active")
become: true
become_user: "{{ postgresql_user }}"
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509

View File

@ -14,17 +14,19 @@
- include_tasks: initialize.yml
- include_tasks: configure.yml
when: postgres_consul_tag is not defined or postgres_consul_tag == "active"
- name: Ensure PostgreSQL is started and enabled on boot.
service:
name: "{{ postgresql_daemon }}"
state: "{{ postgresql_service_state }}"
enabled: "{{ postgresql_service_enabled }}"
when: postgres_consul_tag is not defined or postgres_consul_tag == "active"
# Configure PostgreSQL.
- import_tasks: users.yml
when: postgres_consul_tag is not defined or postgres_consul_tag == "active"
- import_tasks: databases.yml
when: postgres_consul_tag is not defined or postgres_consul_tag == "active"
- name: Import Consul service task
ansible.builtin.import_tasks: consul.yml
when: postgres_consul_service