1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 - name: Install PostgreSQL server package
8 name: "{{ arvados_postgresql_package }}"
10 - name: Find pg_hba.conf file
11 when: arvados_postgresql_hba_file is falsy
14 community.postgresql.postgresql_query:
17 register: pg_hba_query
19 - name: Create pg_hba.conf entries
20 when: arvados_postgresql_hba_databases is truthy and arvados_postgresql_hba_users is truthy
22 loop: "{{ arvados_postgresql_hba_sources }}"
23 community.postgresql.postgresql_pg_hba:
24 dest: "{{ arvados_postgresql_hba_file or pg_hba_query.query_result.0.hba_file }}"
25 contype: "{{ arvados_postgresql_hba_contype }}"
26 databases: "{{ arvados_postgresql_hba_databases }}"
27 method: "{{ arvados_postgresql_hba_method }}"
28 users: "{{ arvados_postgresql_hba_users }}"
30 register: pg_hba_entries
32 - name: Set up PostgreSQL service
34 ansible.builtin.systemd_service:
35 name: "postgresql@{{ (arvados_postgresql_hba_file or pg_hba_query.query_result.0.hba_file)|dirname|relpath('/etc/postgresql')|replace('/', '-') }}.service"
36 state: "{{ 'reloaded' if pg_hba_entries.changed else 'started' }}"