tripleo-validations/validations/ceph-ansible-installed.yaml

37 lines
1.3 KiB
YAML

---
- hosts: undercloud
vars:
metadata:
name: Check if ceph-ansible is installed on the undercloud
description: >
Prints a message if ceph-ansible isn't installed
groups:
- pre-deployment
fail_without_ceph_ansible: false
ceph_ansible_repo: "centos-ceph-luminous"
tasks:
- name: Check if ceph-ansible is installed
command: yum list installed ceph-ansible
args:
warn: no
ignore_errors: true
register: ceph_ansible_installed
changed_when: False
- name: Warn about missing ceph-ansible
warn:
msg: If planning to use Ceph, it is necessary to install the ceph-ansible on the undercloud
when:
- ceph_ansible_installed is failed
- 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:
- (repo.stdout | length == 0 or repo.stdout != "{{ ceph_ansible_repo }}")
- fail_without_ceph_ansible|default(false)|bool