From 62c3a2cbe177cd32072bce92116b58ac247c2f6d Mon Sep 17 00:00:00 2001 From: Kourosh Vivan Date: Fri, 11 Oct 2019 18:16:44 +0200 Subject: [PATCH] Add Centos GPG key custom url When using a custom repo with centos_epel_mirror, you maybe need to change the gpg key url because offline env You can use this variable: lxc_centos_epel_gpg_key Change-Id: Ia30f20df6971a9a44a69e5cc22020831a95a1489 --- defaults/main.yml | 6 ++++++ .../notes/centos-private-epel-3fe4c9ff68ec3a18.yaml | 6 ++++++ tasks/lxc_install_yum.yml | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/centos-private-epel-3fe4c9ff68ec3a18.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 41f2e157..43ff156a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -91,6 +91,12 @@ lxc_container_cache_path: "/var/cache/lxc/download" # copy_from_host: [] # List of files to copy into the container lxc_cache_map: "{{ _lxc_cache_map }}" + +## If you want to use a custom epel repo +# lxc_centos_epel_mirror: http://mirror.myconpany/epel/ +# lxc_centos_epel_gpg_key: http://mirror.myconpany/epel-key/RPM-GPG-KEY-EPEL-7 + + # When using a base container to snapshot from for the overlayfs or LVM # copy-on-write backing stored, the base container can be set. lxc_container_base_name: "{{ lxc_cache_map.distro }}-{{ lxc_cache_map.release }}-{{ lxc_cache_map.arch }}" diff --git a/releasenotes/notes/centos-private-epel-3fe4c9ff68ec3a18.yaml b/releasenotes/notes/centos-private-epel-3fe4c9ff68ec3a18.yaml new file mode 100644 index 00000000..70a0a8a6 --- /dev/null +++ b/releasenotes/notes/centos-private-epel-3fe4c9ff68ec3a18.yaml @@ -0,0 +1,6 @@ +--- +features: + - You can set a private repository for epel, you must use + ``lxc_centos_epel_mirror`` for the repo URL and if you need to get the GPG + key from intranet or a mirror use ``lxc_centos_epel_gpg_key`` for gpg key + location. diff --git a/tasks/lxc_install_yum.yml b/tasks/lxc_install_yum.yml index 4a173011..d482debf 100644 --- a/tasks/lxc_install_yum.yml +++ b/tasks/lxc_install_yum.yml @@ -36,7 +36,7 @@ - name: Install EPEL gpg keys rpm_key: - key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7" + key: "{{ lxc_centos_epel_gpg_key | default ('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7') }}" state: present register: _add_yum_keys until: _add_yum_keys is success @@ -46,7 +46,7 @@ - name: Install the EPEL repository yum_repository: name: epel-lxc_hosts - baseurl: "{{ (centos_epel_mirror | default ('http://download.fedoraproject.org/pub/epel')) ~ '/' ~ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}" + baseurl: "{{ (lxc_centos_epel_mirror | default ('http://download.fedoraproject.org/pub/epel')) ~ '/' ~ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}" description: 'Extra Packages for Enterprise Linux 7 - $basearch' gpgcheck: yes enabled: yes