From 4c592066b7c1caaec700af347fc9edf2109c1659 Mon Sep 17 00:00:00 2001 From: Anthony Rusdi <33247310+antrusd@users.noreply.github.com> Date: Mon, 26 Aug 2019 01:47:32 +0700 Subject: [PATCH] ceph_custom_repo: define apt and rpm key for custom repo This commit also remove the notify on new added debian repo, force update_cache to yes and define sample ceph_custom_key vars. Signed-off-by: Anthony Rusdi <33247310+antrusd@users.noreply.github.com> --- group_vars/all.yml.sample | 1 + group_vars/rhcs.yml.sample | 1 + plugins/actions/validate.py | 5 ++++- .../tasks/installs/debian_custom_repository.yml | 11 +++++++++-- .../tasks/installs/redhat_custom_repository.yml | 8 ++++++++ roles/ceph-defaults/defaults/main.yml | 1 + 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 0f54a0518..ebf82e9cd 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -235,6 +235,7 @@ dummy: # a URL to the .repo file to be installed on the targets. For deb, # ceph_custom_repo should be the URL to the repo base. # +#ceph_custom_key: https://server.domain.com/ceph-custom-repo-key.asc #ceph_custom_repo: https://server.domain.com/ceph-custom-repo diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 515db4b41..5c52b2f8c 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -235,6 +235,7 @@ ceph_rhcs_version: 4 # a URL to the .repo file to be installed on the targets. For deb, # ceph_custom_repo should be the URL to the repo base. # +#ceph_custom_key: https://server.domain.com/ceph-custom-repo-key.asc #ceph_custom_repo: https://server.domain.com/ceph-custom-repo diff --git a/plugins/actions/validate.py b/plugins/actions/validate.py index df42d558d..5c690d183 100644 --- a/plugins/actions/validate.py +++ b/plugins/actions/validate.py @@ -266,7 +266,10 @@ ceph_repository_obs = ( ("ceph_obs_repo", types.string), ) -ceph_repository_custom = ("ceph_custom_repo", types.string) +ceph_repository_custom = ( + ("ceph_custom_key", types.string), + ("ceph_custom_repo", types.string), +) ceph_repository_uca = ( ("ceph_stable_openstack_release_uca", types.string), diff --git a/roles/ceph-common/tasks/installs/debian_custom_repository.yml b/roles/ceph-common/tasks/installs/debian_custom_repository.yml index f3a35b4f3..10c5ea38f 100644 --- a/roles/ceph-common/tasks/installs/debian_custom_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_custom_repository.yml @@ -1,7 +1,14 @@ --- +- name: configure debian custom apt key + apt_key: + url: "{{ ceph_custom_key }}" + state: present + register: result + until: result is succeeded + when: ceph_custom_key is defined + - name: configure debian custom repository apt_repository: repo: "deb {{ ceph_custom_repo }} {{ ansible_distribution_release }} main" state: present - update_cache: no - notify: update apt cache if a repo was added + update_cache: yes diff --git a/roles/ceph-common/tasks/installs/redhat_custom_repository.yml b/roles/ceph-common/tasks/installs/redhat_custom_repository.yml index 273262927..5bdefa2c3 100644 --- a/roles/ceph-common/tasks/installs/redhat_custom_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_custom_repository.yml @@ -1,4 +1,12 @@ --- +- name: configure red hat custom rpm key + rpm_key: + key: "{{ ceph_custom_key }}" + state: present + register: result + until: result is succeeded + when: ceph_custom_key is defined + - name: configure red hat custom repository get_url: url: "{{ ceph_custom_repo }}" diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 27b7f650c..61bd1db49 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -227,6 +227,7 @@ ceph_iscsi_config_dev: true # special repo for deploying iSCSI gateways # a URL to the .repo file to be installed on the targets. For deb, # ceph_custom_repo should be the URL to the repo base. # +ceph_custom_key: https://server.domain.com/ceph-custom-repo-key.asc ceph_custom_repo: https://server.domain.com/ceph-custom-repo -- 2.47.3