Option to install the client only.
This commit is contained in:
parent
1fc4a4527d
commit
96d172ce67
|
@ -10,6 +10,7 @@ postgresql_deb_repo_key: /etc/apt/keyrings/postgresql.asc
|
||||||
postgresql_deb_repository_url: "http://apt.postgresql.org/pub/repos/apt/"
|
postgresql_deb_repository_url: "http://apt.postgresql.org/pub/repos/apt/"
|
||||||
postgresql_deb_repository_rel: "{{ ansible_lsb.codename }}-pgdg"
|
postgresql_deb_repository_rel: "{{ ansible_lsb.codename }}-pgdg"
|
||||||
psql_postgresql_install: true
|
psql_postgresql_install: true
|
||||||
|
postgresql_client_only: false
|
||||||
psql_pkg_state: present
|
psql_pkg_state: present
|
||||||
postgresql_enabled: true
|
postgresql_enabled: true
|
||||||
psql_version: 16
|
psql_version: 16
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
- name: Postgresql external repository
|
- name: Postgresql external repository
|
||||||
ansible.builtin.import_tasks: postgresql_org_repo.yml
|
ansible.builtin.import_tasks: postgresql_org_repo.yml
|
||||||
- name: Manage the postgresql packages
|
- name: Manage the postgresql packages
|
||||||
ansible.builtin.import_tasks: packages.yml
|
ansible.builtin.import_tasks: postgresql-packages.yml
|
||||||
when: psql_postgresql_install
|
when: psql_postgresql_install
|
||||||
- name: Manage the postgis packages
|
- name: Manage the postgis packages
|
||||||
ansible.builtin.import_tasks: postgis.yml
|
ansible.builtin.import_tasks: postgis.yml
|
||||||
|
@ -11,41 +11,54 @@
|
||||||
ansible.builtin.import_tasks: postgresql-config-deb.yml
|
ansible.builtin.import_tasks: postgresql-config-deb.yml
|
||||||
when:
|
when:
|
||||||
- psql_postgresql_install
|
- psql_postgresql_install
|
||||||
|
- not postgresql_client_only
|
||||||
- ansible_distribution_file_variety == "Debian"
|
- ansible_distribution_file_variety == "Debian"
|
||||||
- name: PostgreSQL configuration of EL systems
|
- name: PostgreSQL configuration of EL systems
|
||||||
ansible.builtin.import_tasks: postgresql-config-el.yml
|
ansible.builtin.import_tasks: postgresql-config-el.yml
|
||||||
when:
|
when:
|
||||||
- psql_postgresql_install
|
- psql_postgresql_install
|
||||||
|
- not postgresql_client_only
|
||||||
- ansible_distribution_file_variety == "RedHat"
|
- ansible_distribution_file_variety == "RedHat"
|
||||||
- name: TLS setup
|
- name: TLS setup
|
||||||
ansible.builtin.import_tasks: postgresql-ssl-config.yml
|
ansible.builtin.import_tasks: postgresql-ssl-config.yml
|
||||||
when: psql_postgresql_install
|
when:
|
||||||
|
- psql_postgresql_install
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Kernel sysctl parameters
|
- name: Kernel sysctl parameters
|
||||||
ansible.builtin.import_tasks: psql-kernel-sharedmem.yml
|
ansible.builtin.import_tasks: psql-kernel-sharedmem.yml
|
||||||
when:
|
when:
|
||||||
- psql_postgresql_install
|
- psql_postgresql_install
|
||||||
- psql_set_shared_memory
|
- psql_set_shared_memory
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Configure access to the databases
|
- name: Configure access to the databases
|
||||||
ansible.builtin.import_tasks: configure-access.yml
|
ansible.builtin.import_tasks: configure-access.yml
|
||||||
when:
|
when:
|
||||||
- psql_postgresql_install
|
- psql_postgresql_install
|
||||||
- psql_db_data is defined
|
- psql_db_data is defined
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Service management
|
- name: Service management
|
||||||
ansible.builtin.import_tasks: postgresql-service-status.yml
|
ansible.builtin.import_tasks: postgresql-service-status.yml
|
||||||
when: psql_postgresql_install
|
when:
|
||||||
|
- psql_postgresql_install
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Manage the databases
|
- name: Manage the databases
|
||||||
ansible.builtin.import_tasks: manage_pg_db.yml
|
ansible.builtin.import_tasks: manage_pg_db.yml
|
||||||
when:
|
when:
|
||||||
- psql_postgresql_install
|
- psql_postgresql_install
|
||||||
- psql_db_data is defined
|
- psql_db_data is defined
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Streaming replication setup
|
- name: Streaming replication setup
|
||||||
ansible.builtin.import_tasks: postgresql-streaming-replication.yml
|
ansible.builtin.import_tasks: postgresql-streaming-replication.yml
|
||||||
when:
|
when:
|
||||||
- postgresql_streaming_replication
|
- postgresql_streaming_replication
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Local backups
|
- name: Local backups
|
||||||
ansible.builtin.import_tasks: postgresql-backup.yml
|
ansible.builtin.import_tasks: postgresql-backup.yml
|
||||||
when: psql_postgresql_install
|
when:
|
||||||
|
- psql_postgresql_install
|
||||||
|
- not postgresql_client_only
|
||||||
- name: Letsencrypt hook
|
- name: Letsencrypt hook
|
||||||
ansible.builtin.import_tasks: postgresql-letsencrypt-acmetool.yml
|
ansible.builtin.import_tasks: postgresql-letsencrypt-acmetool.yml
|
||||||
when:
|
when:
|
||||||
- postgresql_letsencrypt_managed
|
- postgresql_letsencrypt_managed
|
||||||
|
- not postgresql_client_only
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
---
|
|
||||||
- block:
|
|
||||||
- name: install the postgresql packages
|
|
||||||
apt: pkg={{ postgresql_pkgs }} state={{ psql_pkg_state }} cache_valid_time=3600
|
|
||||||
notify: Restart postgresql
|
|
||||||
|
|
||||||
when: ansible_distribution_file_variety == "Debian"
|
|
||||||
tags: [ 'postgresql', 'postgres' ]
|
|
||||||
|
|
||||||
- name: EL
|
|
||||||
block:
|
|
||||||
- name: install the postgresql packages from the pgdg repository
|
|
||||||
yum: pkg={{ psql_el_pgdg_packages }} state={{ psql_pkg_state }}
|
|
||||||
|
|
||||||
- name: Init the db if needed
|
|
||||||
command: /usr/pgsql-{{ psql_version }}/bin/postgresql-{{ psql_version }}-setup initdb
|
|
||||||
args:
|
|
||||||
creates: '{{ psql_el_data_dir }}/postgresql.conf'
|
|
||||||
|
|
||||||
when:
|
|
||||||
- not psql_el_install_scl_version
|
|
||||||
- ansible_distribution_file_variety == "RedHat"
|
|
||||||
tags: [ 'postgresql', 'postgres' ]
|
|
||||||
|
|
||||||
- name: EL from SCL
|
|
||||||
block:
|
|
||||||
- name: install the postgresql scl packages
|
|
||||||
yum: pkg={{ psql_el_scl_packages }} state={{ psql_pkg_state }}
|
|
||||||
|
|
||||||
- name: Init the db if needed
|
|
||||||
command: /opt/rh/rh-postgresql{{ psql_version }}/root/usr/bin/postgresql-setup --initdb
|
|
||||||
args:
|
|
||||||
creates: '{{ psql_el_data_dir }}/postgresql.conf'
|
|
||||||
|
|
||||||
when:
|
|
||||||
- psql_el_install_scl_version
|
|
||||||
- ansible_distribution_file_variety == "RedHat"
|
|
||||||
tags: [ 'scl', 'postgresql', 'postgres' ]
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
---
|
||||||
|
- name: postgresql-packages | Manage the postgresql packages installation
|
||||||
|
when:
|
||||||
|
- ansible_distribution_file_variety == "Debian"
|
||||||
|
- not postgresql_client_only
|
||||||
|
tags: ['postgresql', 'postgres']
|
||||||
|
block:
|
||||||
|
- name: postgresql-packages | Install the postgresql server packages on Deb systems
|
||||||
|
ansible.builtin.apt:
|
||||||
|
pkg: "{{ postgresql_pkgs }}"
|
||||||
|
state: present
|
||||||
|
cache_valid_time: 3600
|
||||||
|
notify: Restart postgresql
|
||||||
|
|
||||||
|
- name: postgresql-packages | Manage the postgresql client installation
|
||||||
|
when:
|
||||||
|
- ansible_distribution_file_variety == "Debian"
|
||||||
|
- postgresql_client_only
|
||||||
|
tags: ['postgresql', 'postgres']
|
||||||
|
block:
|
||||||
|
- name: postgresql-packages | Install the postgresql server packages on Deb systems
|
||||||
|
ansible.builtin.apt:
|
||||||
|
pkg: postgresql-client
|
||||||
|
state: present
|
||||||
|
cache_valid_time: 3600
|
||||||
|
|
||||||
|
- name: postgresql-packages | EL server packages
|
||||||
|
when:
|
||||||
|
- not psql_el_install_scl_version
|
||||||
|
- not postgresql_client_only
|
||||||
|
- ansible_distribution_file_variety == "RedHat"
|
||||||
|
tags: ['postgresql', 'postgres']
|
||||||
|
block:
|
||||||
|
- name: postgresql-packages | Install the postgresql packages from the pgdg repository
|
||||||
|
ansible.builtin.yum:
|
||||||
|
pkg: "{{ psql_el_pgdg_packages }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: postgresql-packages | Init the db if needed
|
||||||
|
ansible.builtin.command: /usr/pgsql-{{ psql_version }}/bin/postgresql-{{ psql_version }}-setup initdb
|
||||||
|
args:
|
||||||
|
creates: '{{ psql_el_data_dir }}/postgresql.conf'
|
||||||
|
|
||||||
|
- name: postgresql-packages | EL server packagesx from SCL
|
||||||
|
when:
|
||||||
|
- psql_el_install_scl_version
|
||||||
|
- ansible_distribution_file_variety == "RedHat"
|
||||||
|
- not postgresql_client_only
|
||||||
|
tags: ['scl', 'postgresql', 'postgres']
|
||||||
|
block:
|
||||||
|
- name: postgresql-packages | Install the postgresql scl packages
|
||||||
|
ansible.builtin.yum:
|
||||||
|
pkg: "{{ psql_el_scl_packages }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: postgresql-packages | Init the db if needed
|
||||||
|
ansible.builtin.command: /opt/rh/rh-postgresql{{ psql_version }}/root/usr/bin/postgresql-setup --initdb
|
||||||
|
args:
|
||||||
|
creates: '{{ psql_el_data_dir }}/postgresql.conf'
|
||||||
|
|
||||||
|
- name: postgresql-packages | EL client packages
|
||||||
|
when:
|
||||||
|
- not psql_el_install_scl_version
|
||||||
|
- postgresql_client_only
|
||||||
|
- ansible_distribution_file_variety == "RedHat"
|
||||||
|
tags: ['postgresql', 'postgres']
|
||||||
|
block:
|
||||||
|
- name: postgresql-packages | Install the postgresql client from the pgdg repository
|
||||||
|
ansible.builtin.yum:
|
||||||
|
pkg: "postgresql{{ psql_version }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: postgresql-packages | EL server packagesx from SCL
|
||||||
|
when:
|
||||||
|
- psql_el_install_scl_version
|
||||||
|
- ansible_distribution_file_variety == "RedHat"
|
||||||
|
- postgresql_client_only
|
||||||
|
tags: ['scl', 'postgresql', 'postgres']
|
||||||
|
block:
|
||||||
|
- name: postgresql-packages | Install the postgresql scl client package
|
||||||
|
ansible.builtin.yum:
|
||||||
|
pkg: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop:
|
||||||
|
- "rh-postgresql{{ psql_version }}-runtime"
|
||||||
|
- "rh-postgresql{{ psql_version }}-postgresql"
|
Loading…
Reference in New Issue