ansible-role-postgresql/tasks/postgresql_org_repo.yml

49 lines
1.6 KiB
YAML

---
- name: postgresql_org_repo | Debian or Ubuntu
when:
- pg_use_postgresql_org_repo
- ansible_distribution_file_variety == "Debian"
tags: ['postgresql', 'postgresql_repo', 'postgres_client']
block:
- name: postgresql_org_repo | Ensure that /etc/apt.d/keyrings exists
ansible.builtin.file:
dest: /etc/apt/keyrings
state: directory
owner: root
group: root
mode: "0755"
- name: postgresql_org_repo | Get the signing key for the postgresql.org repository
ansible.builtin.get_url:
url: "{{ postgresql_deb_repo_key_url }}"
dest: "{{ postgresql_deb_repo_key }}"
owner: root
group: root
mode: "0644"
- name: postgresql_org_repo | Install the repository for Ubuntu
ansible.builtin.deb822_repository:
name: postgresql-org
types: [deb]
uris: "{{ postgresql_deb_repository_url }}"
components:
- main
suites: ["{{ postgresql_deb_repository_rel }}"]
signed_by: "{{ postgresql_deb_repo_key }}"
state: present
enabled: true
register: postgresql_org_repo
- name: postgresql_org_repo | Update the apt cache
ansible.builtin.apt:
update_cache: yes
when: postgresql_org_repo is changed
- name: postgresql_org_repo | Manage the EL repository
when:
- pg_use_postgresql_org_repo
- ansible_distribution_file_variety == "RedHat"
tags: ['postgresql', 'postgresql_repo', 'postgres_client']
block:
- name: postgresql_org_repo | Install the pgsql pgdg repository
ansible.builtin.yum:
name: "{{ psql_el_pgdg_repo_url }}"
state: present