- name: "Install PostgreSQL" include_tasks: install.yaml tags: postgresql_installation - name: "Configure PostgreSQL" include_tasks: config.yaml tags: postgresql_configuration - name: "Manage TLS/SSL certificates" #include_tasks: cacert.yaml include_tasks: ssl/main.yaml when: postgresql_ssl - name: Include WAL-G role ansible.builtin.include_role: name: wal-g vars: wal_g_pg: yes wal_g_pg_home_dir: "{{ postgresql_home_dir }}" wal_g_pg_data_dir: "{{ postgresql_data_dir }}" wal_g_restore: "{{ postgresql_wal_g_restore }}" when: postgresql_wal_g_install - name: Include PostgreSQL restore include_tasks: restore.yaml when: postgresql_wal_g_restore_from_backup - name: "PostgreSQL initdb" become_user: "{{ postgresql_superuser_username }}" shell: "/usr/lib/postgresql/{{ postgresql_major_version }}/bin/initdb -D {{ postgresql_data_dir }} --username {{ postgresql_superuser_username }} --auth-local peer --auth-host {{ postgresql_password_encryption_algorithm }} --no-instructions" register: initdb changed_when: "'exists but is not empty' not in initdb.stderr" failed_when: false