Skip to content

Commit

Permalink
check if postgresql_ext_extra_packages exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Lavaud committed Dec 7, 2023
1 parent a76034b commit 3239401
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tasks/extensions/extra_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
state: present
keyring: /etc/apt/trusted.gpg.d/{{ item.value.id }}.gpg
loop: "{{ postgresql_ext_extra_packages.apt_keys | default({}) | dict2items }}"
when: ansible_os_family == "Debian"
when:
- postgresql_ext_extra_packages is defined
- ansible_os_family == "Debian"

# repositories
- name: PostgreSQL | Extensions | Add repos | apt
apt_repository:
repo: "{{ item.value }}"
state: present
loop: "{{ postgresql_ext_extra_packages.apt_repositories | default({}) | dict2items }}"
when: ansible_os_family == "Debian"
when:
- postgresql_ext_extra_packages is defined
- ansible_os_family == "Debian"
- name: PostgreSQL | Extensions | Add repos | RHEL
yum_repository:
name: "{{ item.value.name }}"
Expand All @@ -27,7 +31,9 @@
gpgkey: "{{ item.value.gpgkey }}"
enabled: yes
loop: "{{ postgresql_ext_extra_packages.yum_repositories | default({}) | dict2items }}"
when: ansible_os_family == "RedHat"
when:
- postgresql_ext_extra_packages is defined
- ansible_os_family == "RedHat"

# packages
- name: PostgreSQL | Extensions | Add packages | apt
Expand All @@ -36,10 +42,14 @@
state: present
update_cache: yes
cache_valid_time: "{{ apt_cache_valid_time | default (3600) }}"
when: ansible_os_family == "Debian"
when:
- postgresql_ext_extra_packages is defined
- ansible_os_family == "Debian"
- name: PostgreSQL | Extensions | Add packages | RHEL
yum:
name: "{{ postgresql_ext_extra_packages.names }}"
state: present
update_cache: yes
when: ansible_os_family == "RedHat"
when:
- postgresql_ext_extra_packages is defined
- ansible_os_family == "RedHat"

0 comments on commit 3239401

Please sign in to comment.