2017-03-23 17:04:35 +01:00
|
|
|
---
|
2017-03-28 16:46:47 +02:00
|
|
|
- name: Open firewall for PGDG repository
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.replace:
|
2017-03-28 16:46:47 +02:00
|
|
|
name: /etc/default/minifirewall
|
2022-06-09 10:33:28 +02:00
|
|
|
regexp: "^(HTTPSITES='((?!apt\\.postgresql\\.org|0\\.0\\.0\\.0).)*)'$"
|
2017-03-28 16:46:47 +02:00
|
|
|
replace: "\\1 apt.postgresql.org'"
|
|
|
|
notify: Restart minifirewall
|
|
|
|
|
2023-03-20 23:33:19 +01:00
|
|
|
- ansible.builtin.meta: flush_handlers
|
2017-03-28 16:46:47 +02:00
|
|
|
|
2021-05-03 14:23:13 +02:00
|
|
|
- name: Add PGDG GPG key
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.copy:
|
2021-06-28 15:53:55 +02:00
|
|
|
src: postgresql.asc
|
2022-11-02 23:15:17 +01:00
|
|
|
dest: "{{ apt_keyring_dir }}/postgresql.asc"
|
2023-06-28 13:22:59 +02:00
|
|
|
force: true
|
2021-05-03 14:23:13 +02:00
|
|
|
mode: "0644"
|
2021-05-26 13:47:34 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
2017-03-23 17:04:35 +01:00
|
|
|
|
2023-03-19 11:44:53 +01:00
|
|
|
- name: Add PGDG repository (Debian <12)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.apt_repository:
|
2022-12-28 09:03:37 +01:00
|
|
|
repo: "deb [signed-by={{ apt_keyring_dir }}/postgresql.asc] http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main"
|
2023-03-19 11:44:53 +01:00
|
|
|
filename: postgresql
|
2020-11-30 10:51:34 +01:00
|
|
|
update_cache: yes
|
2023-03-19 11:44:53 +01:00
|
|
|
when: ansible_distribution_major_version is version('12', '<')
|
2020-11-30 10:51:34 +01:00
|
|
|
|
2023-03-19 11:44:53 +01:00
|
|
|
- name: Add PGDG repository (Debian >=12)
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: postgresql.sources.j2
|
|
|
|
dest: /etc/apt/sources.list.d/postgresql.sources
|
|
|
|
state: present
|
|
|
|
register: postgresql_sources
|
|
|
|
when: ansible_distribution_major_version is version('12', '>=')
|
|
|
|
|
|
|
|
- name: Update APT cache
|
|
|
|
ansible.builtin.apt:
|
2022-12-02 15:17:42 +01:00
|
|
|
update_cache: yes
|
2023-03-19 11:44:53 +01:00
|
|
|
when: elastic_sources is changed
|
2022-12-02 15:17:42 +01:00
|
|
|
|
2017-03-23 17:04:35 +01:00
|
|
|
- name: Add APT preference file
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.template:
|
2018-02-04 11:34:05 +01:00
|
|
|
src: postgresql.pref.j2
|
2020-11-27 11:07:18 +01:00
|
|
|
dest: /etc/apt/preferences.d/postgresql.pref
|
2017-03-23 17:04:35 +01:00
|
|
|
mode: "0644"
|