mirror of
https://gitea.0xace.cc/ansible-galaxy/postgresql.git
synced 2024-11-28 17:56:40 +00:00
52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
- name: Install deps packages
|
|
dnf:
|
|
name: "{{ postgresql_deps_packages }}"
|
|
state: present
|
|
|
|
- name: Disable PostgreSQL module
|
|
shell: dnf module disable -y postgresql
|
|
register: disable_postgresql_module
|
|
changed_when: "'Nothing to do' not in disable_postgresql_module.stdout"
|
|
when:
|
|
- ansible_facts['distribution_major_version'] == '8'
|
|
|
|
- name: Add PostgreSQL repository
|
|
dnf:
|
|
name: "{{ postgresql_repo_package }}"
|
|
disable_gpg_check: yes
|
|
state: present
|
|
|
|
- name: "Install {{ postgresql_package_name }} {{ postgresql_version }}"
|
|
dnf:
|
|
name: "{{ postgresql_package }}"
|
|
state: present
|
|
disable_gpg_check: yes
|
|
register: postgresql_setup
|
|
|
|
- name: Include data direcory
|
|
include_tasks: data_dir.yaml
|
|
|
|
- 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
|
|
|
|
- name: PostgreSQL Initdb
|
|
shell: "/usr/pgsql-{{ postgresql_major_version }}/bin/postgresql-{{ postgresql_major_version }}-setup initdb"
|
|
register: initdb
|
|
changed_when: "'Data directory is not empty!' not in initdb.stdout"
|
|
failed_when: false
|
|
|
|
- name: "Configure PostgreSQL"
|
|
include_tasks: config.yaml
|
|
tags: postgresql_configuration
|