Skip to content

Commit

Permalink
add enable_epel_repo and enable_pgdg_repo flags
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahms committed Feb 27, 2023
1 parent 37505ec commit 2c522e2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
8 changes: 8 additions & 0 deletions roles/setup_repo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ When executing the role via Ansible these are the required variables:
EDB repository token used to access EDB package repository.
Required when **enable_edb_repo** is set to `true` and **repo_username** and **repo_password** aren't used.

* **enable_pgdg_repo**

Configure access to the PGDG package repository. Default: `true`. Only set to `false` when using local repositories.

* **enable_epel_repo**

Configure access to EPEL package repository on EL8 distributions. Default: `true`. Only set to `false` when using local repositories.

* **yum_additional_repos**

List of additional YUM repositories. List items are dictionnaries:
Expand Down
6 changes: 6 additions & 0 deletions roles/setup_repo/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ repo_password: ""
tpa_subscription_token: ""
install_bdr_packages: false

# set to false only if you are using local repositories and do not need the PGDG and/or EPEL repositories.
# setting to false will result in failure to download required packages if access to local repos is not available
enable_pgdg_repo: true
enable_epel_repo: true

# EDB RPM Repo
edb_rpm_repo: "http://yum.enterprisedb.com/edbrepos/edb-repo-latest.noarch.rpm"
edb_gpg_key_8: "https://yum.enterprisedb.com/ENTERPRISEDB-GPG-KEY"
Expand Down Expand Up @@ -72,3 +77,4 @@ supported_pg_version:
- 12
- 13
- 14
- 15
9 changes: 7 additions & 2 deletions roles/setup_repo/tasks/PG_Debian_setuprepos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
update_cache: true
state: present
become: true
when: enable_edb_repo|bool or enable_pgdg_repo|bool

- name: Add EDB Debian 9 repo
ansible.builtin.apt_repository:
Expand All @@ -70,15 +71,19 @@
ansible.builtin.apt_key:
url: "{{ pg_deb_keys }}"
state: present
when: pg_type == 'PG'
when:
- pg_type == 'PG'
- enable_pgdg_repo|bool
become: true

- name: Add PG Debian repo
ansible.builtin.apt_repository:
repo: "{{ pg_deb_repo_url }}"
state: present
filename: "pgdg"
when: pg_type == 'PG'
when:
- pg_type == 'PG'
- enable_pgdg_repo|bool
become: true

- name: Add additional Debian repositories
Expand Down
20 changes: 16 additions & 4 deletions roles/setup_repo/tasks/PG_RedHat_setuprepos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
when:
- ansible_distribution_major_version == '8'
- pg_type == 'PG'
- enable_pgdg_repo|bool
become: true

- name: Download EPEL GPG key for EL8
Expand All @@ -29,13 +30,16 @@
state: present
when:
- ansible_distribution_major_version == '8'
- enable_epel_repo|bool
become: true

- name: Install EPEL repo for EL7
ansible.builtin.package:
name: "{{ epel_repo_7 }}"
state: present
when: ansible_distribution_major_version == '7'
when:
- ansible_distribution_major_version == '7'
- enable_epel_repo|bool
become: true

- name: Install PG repo for EL7
Expand All @@ -46,25 +50,32 @@
when:
- ansible_distribution_major_version == '7'
- pg_type == 'PG'
- enable_pgdg_repo|bool

- name: Install dnf-plugins-core for EL8
ansible.builtin.package:
name: dnf-plugins-core
state: present
become: true
when: ansible_distribution_major_version == '8'
when:
- ansible_distribution_major_version == '8'
- enable_epel_repo|bool

- name: Enable powertools for EL8
ansible.builtin.command: >
dnf config-manager --set-enabled powertools
become: true
when: ansible_distribution_major_version == '8'
when:
- ansible_distribution_major_version == '8'
- enable_epel_repo|bool

- name: Install EPEL repo for EL8
ansible.builtin.package:
name: "{{ epel_repo_8 }}"
state: present
when: ansible_distribution_major_version == '8'
when:
- ansible_distribution_major_version == '8'
- enable_epel_repo|bool
become: true

- name: Install PG repo for EL8
Expand All @@ -75,6 +86,7 @@
when:
- ansible_distribution_major_version == '8'
- pg_type == 'PG'
- enable_pgdg_repo|bool

- name: Install EPAS repo for RedHat
ansible.builtin.package:
Expand Down

0 comments on commit 2c522e2

Please sign in to comment.