tripleo-validations/roles/ceph/tasks/ceph-ansible-installed.yaml
Francesco Pantano 082d48b109 Fix ceph-ansible permissions when checking the repo name
The purpose of this fix is to address a bug hit during
upgrades: in order to run yum info the current user should
be able to download metadata for repositories and a privileges
escalation is required by pkg manager.

Change-Id: I248fc36ab3b1f4a81a6884b18fba5fcc0cff08ea
(cherry picked from commit a87793fcd9)
2020-07-07 00:33:31 +02:00

38 lines
1.3 KiB
YAML

---
- name: Check if ceph-ansible is installed
shell: rpm -q ceph-ansible || true
args:
warn: false
changed_when: false
ignore_errors: true
register: ceph_ansible_installed
- name: Warn about missing ceph-ansible
warn:
msg: If planning to use Ceph, it is necessary to install the ceph-ansible package on the undercloud
when:
- ceph_ansible_installed.stdout.find('is not installed') != -1
- not fail_without_ceph_ansible|default(false)|bool
- name: Fail if ceph-ansible is missing
fail:
msg: If planning to use Ceph, it is necessary to install the ceph-ansible package on the undercloud
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}'"
become: true
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 }} \
or configure the repo name you intend to install it from using the \
'CephAnsibleRepo' variable provided by tripleo-heat-templates"
when:
- (repo.stdout | length == 0 or repo.stdout != "{{ ceph_ansible_repo }}")
- fail_without_ceph_ansible|default(false)|bool