tripleo-ansible/tripleo_ansible/roles/tripleo_cephadm/molecule/default/verify.yml

91 lines
3.6 KiB
YAML

---
# Copyright 2021 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Fail if the FSID is not defined or not valid
fail:
msg: "The tripleo_cephadm_fsid {{ tripleo_ceph_client_fsid|default('') }} variable is either undefined or not valid"
when:
- tripleo_cephadm_fsid is not defined
- tripleo_cephadm_fsid | regex_search(regex)
vars:
- regex: '\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b'
- name: Stat pre ceph conf file
stat:
path: "{{ tripleo_cephadm_bootstrap_conf }}"
register: tripleo_cephadm_bootstrap_conf_stat
become: true
- name: Fail if pre ceph conf file is missing
fail:
msg: "{{ tripleo_cephadm_bootstrap_conf }} does not exist according to stat"
when:
- tripleo_cephadm_bootstrap_conf_stat.stat.exists is not defined
- name: Stat spec file on bootstrap node
stat:
path: "{{ item }}"
register: tripleo_cephadm_spec_files_stat
become: true
loop:
- "{{ tripleo_cephadm_spec }}"
- name: Fail if spec file is missing
fail:
msg: "{{ item.invocation.module_args.path }} does not exist"
loop: "{{ tripleo_cephadm_spec_files_stat.results | list }}"
when: not item.stat.exists
- name: Get ceph_cli
include_tasks: "../../tasks/ceph_cli.yaml"
vars:
mount_spec: true
- name: Assert that ceph_cli contains expected parameters
assert:
that:
- tripleo_cephadm_ceph_cli | regex_search('^' + tripleo_cephadm_container_cli + ' run --rm')
- tripleo_cephadm_ceph_cli | regex_search(tripleo_cephadm_container_options)
- tripleo_cephadm_ceph_cli | regex_search(ceph_vol)
- tripleo_cephadm_ceph_cli | regex_search(spec_vol)
- tripleo_cephadm_ceph_cli | regex_search('--entrypoint ceph')
- tripleo_cephadm_ceph_cli | regex_search(image)
- tripleo_cephadm_ceph_cli | regex_search('--fsid ' + tripleo_cephadm_fsid)
- tripleo_cephadm_ceph_cli | regex_search('-c ' + tripleo_cephadm_conf)
- tripleo_cephadm_ceph_cli | regex_search('-k ' + tripleo_cephadm_admin_keyring)
vars:
ceph_vol: "--volume {{ tripleo_cephadm_config_home }}:{{ tripleo_cephadm_config_home }}:z"
spec_vol: "--volume {{ tripleo_cephadm_spec }}:{{ tripleo_cephadm_container_spec }}:z"
image: "{{ tripleo_cephadm_container_ns }}/{{ tripleo_cephadm_container_image }}:{{ tripleo_cephadm_container_tag }}"
- name: Confirm we can inlcude_vars the generated tripleo_ceph_client input file
include_vars: "{{ tripleo_ceph_client_vars }}"
delegate_to: localhost
- name: Assert that the generated client vars are correct
assert:
that:
- tripleo_ceph_client_fsid == tripleo_cephadm_fsid
- external_cluster_mon_ips == ips
- keys[0].name == 'client.openstack'
- keys[0].key == 'AQATZBBgAAAAABAAUl/GZvcldk6G74AoZ2v2rg=='
- keys[0].caps.mgr == 'allow *'
- keys[0].caps.mon == 'profile rbd'
- keys[0].caps.osd == osd_profile
vars:
osd_profile: 'profile rbd pool=vms, profile rbd pool=volumes, profile rbd pool=images'
ips: '[v2:172.16.11.241:3300/0,v1:172.16.11.241:6789/0],[v2:172.16.11.176:3300/0,v1:172.16.11.176:6789/0],[v2:172.16.11.82:3300/0,v1:172.16.11.82:6789/0]'