Add a validation to fail if a Ceph dependency is not installed

When the overcloud is deployed with Ceph we need to install all the
ceph dependencies on the overcloud nodes.
If a ceph dependency is missing, a warning message is displayed and we
can also let the playbook fail setting the related boolean.
Furthermore, if the package is found, the playbook check if a new
version is available.

Closes-Bug: 1855692
Change-Id: I85d09955e839bab35cc06d2f0906f3012c8a1aa9
(cherry picked from commit 7fe786039b)
This commit is contained in:
Francesco Pantano 2019-12-16 21:17:01 +01:00
parent 2bba53a15d
commit 6f850ab60b
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,17 @@
---
- hosts: overcloud
vars:
metadata:
name: Check if Ceph dependencies are installed
description: >
Prints a message if a ceph dependency is missed
groups:
- pre-deployment
fail_without_deps: true
tripleo_delegate_to: "{{ groups['overcloud'] | default([]) }}"
packages:
- lvm2
tasks:
- include_role:
name: ceph
tasks_from: "ceph-dependencies-installed"

View File

@ -1,5 +1,6 @@
---
fail_without_ceph_ansible: false
fail_without_deps: false
fail_on_ceph_health_err: false
osd_percentage_min: 0

View File

@ -0,0 +1,26 @@
---
- name: Gather the package facts
package_facts:
manager: auto
- name: Warn about missing dependencies
warn:
msg: "If planning to use Ceph, it is necessary to check {{ item[0] }} is installed!"
when:
- "'{{ item[0] }}' not in ansible_facts.packages"
- not fail_without_deps|default(false)|bool
delegate_to: "{{ item[1] }}"
with_nested:
- "{{ packages }}"
- "{{ tripleo_delegate_to }}"
- name: Fail if a ceph dependency is missing
fail:
msg: "If planning to use Ceph, it is necessary to install {{ item[0] }} package"
when:
- "'{{ item[0] }}' not in ansible_facts.packages"
- fail_without_deps|default(false)|bool
delegate_to: "{{ item[1] }}"
with_nested:
- "{{ packages }}"
- "{{ tripleo_delegate_to }}"