ansible-roles/postgresql/tasks/pgdg-repo.yml
Jérémy Lecour 00fe225a3c
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2615|7|2608|177|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/278//ansiblelint">Evolix » ansible-roles » unstable #278</a>
gitea/ansible-roles/pipeline/head This commit looks good
force: [yes,no] → force [true,false]
2023-06-28 13:25:30 +02:00

45 lines
1.3 KiB
YAML

---
- name: Open firewall for PGDG repository
ansible.builtin.replace:
name: /etc/default/minifirewall
regexp: "^(HTTPSITES='((?!apt\\.postgresql\\.org|0\\.0\\.0\\.0).)*)'$"
replace: "\\1 apt.postgresql.org'"
notify: Restart minifirewall
- ansible.builtin.meta: flush_handlers
- name: Add PGDG GPG key
ansible.builtin.copy:
src: postgresql.asc
dest: "{{ apt_keyring_dir }}/postgresql.asc"
force: true
mode: "0644"
owner: root
group: root
- name: Add PGDG repository (Debian <12)
ansible.builtin.apt_repository:
repo: "deb [signed-by={{ apt_keyring_dir }}/postgresql.asc] http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main"
filename: postgresql
update_cache: yes
when: ansible_distribution_major_version is version('12', '<')
- 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:
update_cache: yes
when: elastic_sources is changed
- name: Add APT preference file
ansible.builtin.template:
src: postgresql.pref.j2
dest: /etc/apt/preferences.d/postgresql.pref
mode: "0644"