Add an additional validation to check ceph-ansible repository

In order to address the ceph-ansible potential cross-shipping,
this change adds an extra task to validate the repository that
should be used to install ceph-ansible in the undercloud.
If ceph-ansible is not installed or the repo doesn't match the
specified one, this validation raise an error.

Change-Id: Ib80b55cbd0d4b4dd83d8dbc9dc2afe1d6df2ede5
(cherry picked from commit 329f740d10)
This commit is contained in:
Francesco Pantano 2019-12-09 20:12:37 +01:00
parent 2bba53a15d
commit 7f9f738668
3 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,7 @@
groups:
- pre-deployment
fail_without_ceph_ansible: false
ceph_ansible_repo: "centos-ceph-nautilus"
tasks:
- include_role:
name: ceph

View File

@ -2,4 +2,5 @@
fail_without_ceph_ansible: false
fail_on_ceph_health_err: false
osd_percentage_min: 0
ceph_ansible_repo: "centos-ceph-nautilus"

View File

@ -20,3 +20,16 @@
when:
- ceph_ansible_installed.stdout.find('is not installed') != -1
- fail_without_ceph_ansible|default(false)|bool
- name: Get ceph-ansible repository
shell: "yum info ceph-ansible | awk '/From repo/ {print $4}'"
register: repo
changed_when: False
- name: Fail if ceph-ansible doesn't belong to the specified repo
fail:
msg: "Make sure ceph-ansible package is installed from {{ ceph_ansible_repo }}"
when:
- fail_without_ceph_ansible|default(false)|bool
- (repo.stdout | length > 0 or repo.stdout != "{{ ceph_ansible_repo }}")