TripleO Ansible project repository. Contains playbooks for use with TripleO OpenStack deployments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

200 lines
8.1 KiB

---
# Copyright 2020 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: Converge
hosts: all
roles:
- role: "tripleo_ceph_client"
tripleo_ceph_client_config_home: "/etc/ceph"
tripleo_ceph_client_fsid: "1dee28aa-2eba-11eb-b30b-244200b898e6"
tripleo_ceph_client_mon_ips:
- 172.16.3.10
- 172.16.3.11
- 172.16.3.12
tripleo_ceph_client_keys:
- caps:
mgr: allow *
mon: profile rbd
osd: profile rbd pool=vms, profile rbd pool=volumes, profile rbd pool=metrics,
profile rbd pool=backups, profile rbd pool=pool2, profile rbd pool=pool3,
profile rbd pool=altrbd
key: AQC+vYNXgDAgAhAAc8UoYt+OTz5uhV7ItLdwUw==
mode: '0600'
name: client.glance
- caps:
mgr: allow *
mon: profile rbd
osd: profile rbd pool=images
key: AQBRgQ9eAAAAABAAv84zEilJYZPNuJ0Iwn9Ndg==
mode: '0600'
name: client.manila
tripleo_ceph_client_config_overrides:
global:
osd_pool_default_pg_num: 16
osd_pool_default_pgp_num: 16
osd_pool_default_size: 1
topkey: 'topvalue'
client:
rbd_cache: true
rbd_cache_writethrough_until_flush: true
rbd_concurrent_management_ops: 20
osdkey: 'osdvalue'
tasks:
- name: Check the tripleo_ceph_client_fetch_dir content
block:
- name: Check current file
stat:
path: "{{ tripleo_ceph_client_fetch_dir }}/{{ item }}"
register: st
loop: "{{ expected_files }}"
- fail:
msg: "The file {{ item }} doesn't exist"
when: not item.stat.exists
loop: "{{ st.results }}"
- name: Show the content of the generated Ceph config file
shell: "cat {{ tripleo_ceph_client_fetch_dir +'/'+ tripleo_ceph_client_cluster + '.conf' }}"
register: cat_ceph_conf
when: verbosity
- debug:
msg: "{{ cat_ceph_conf.stdout }}"
when: verbosity
vars:
tripleo_ceph_client_cluster: "ceph"
verbosity: true
expected_files:
- '{{ tripleo_ceph_client_cluster }}.client.glance.keyring'
- '{{ tripleo_ceph_client_cluster }}.client.manila.keyring'
- '{{ tripleo_ceph_client_cluster }}.conf'
- name: Run tripleo_ceph_client with ceph_external_multi_config
block:
- include_role:
name: tripleo_ceph_client
name: Call tripleo_ceph_client and pass multiple
vars:
tripleo_ceph_client_config_home: "/var/lib/tripleo-config/ceph"
multiple: "{{ item }}"
loop: "{{ ceph_external_multi_config }}"
- name: grep expected content from generated Ceph config files for dcn0/dcn1
shell: "grep {{ item.fsid }} {{ tripleo_ceph_client_fetch_dir +'/'+ item.cluster +'.conf' }} | wc -l"
register: grep_ceph_conf_dcn
loop:
- {cluster: 'dcn0', fsid: 'b6d6c1b9-cb48-4e1f-a48b-63b27a704ab1'}
- {cluster: 'dcn1', fsid: 'cf9b830d-8c6a-418f-b6ce-a9156ae014ba'}
- name: Fail if expected FSID is not found in dcn0 or dcn1 Ceph conf file
fail:
msg: "'{{ item.cmd }}' returned {{ item.stdout }} instead of 1"
when: not item.stdout == '1'
loop: "{{ grep_ceph_conf_dcn.results }}"
- name: grep expected content from generated cephx files for dcn0/dcn1
shell: "grep {{ item.key }} {{ tripleo_ceph_client_fetch_dir +'/'+ item.cluster + '.client.openstack.keyring' }} | wc -l"
register: grep_cephx_dcn
loop:
- {cluster: 'dcn0', key: 'AQAqFN1fAAAAABAAkHoVtZxSvvRbwYtZ4LwNZA=='}
- {cluster: 'dcn1', key: 'AQAqJt1fAAAAABAATLe3ZcGWrahsG2wp17nPVQ=='}
- name: Fail if expected cephx key is not found in dcn0 or dcn1 keyring file
fail:
msg: "'{{ item.cmd }}' returned {{ item.stdout }} instead of 1"
when: not item.stdout == '1'
loop: "{{ grep_cephx_dcn.results }}"
vars:
ceph_external_multi_config:
- cluster: dcn0
ceph_conf_overrides:
client:
keyring: /etc/ceph/dcn0.client.openstack.keyring
dashboard_enabled: false
external_cluster_mon_ips: 192.168.24.7,192.168.24.14,192.168.24.24
fsid: b6d6c1b9-cb48-4e1f-a48b-63b27a704ab1
keys:
- caps:
mgr: allow *
mon: profile rbd
osd: profile rbd pool=vms, profile rbd pool=volumes, profile rbd pool=images
key: AQAqFN1fAAAAABAAkHoVtZxSvvRbwYtZ4LwNZA==
mode: '0600'
name: client.openstack
- cluster: dcn1
ceph_conf_overrides:
client:
keyring: /etc/ceph/dcn1.client.openstack.keyring
dashboard_enabled: false
external_cluster_mon_ips: 192.168.25.7,192.168.25.14,192.168.25.24
fsid: cf9b830d-8c6a-418f-b6ce-a9156ae014ba
keys:
- caps:
mgr: allow *
mon: profile rbd
osd: profile rbd pool=vms, profile rbd pool=volumes, profile rbd pool=images
key: AQAqJt1fAAAAABAATLe3ZcGWrahsG2wp17nPVQ==
mode: '0600'
name: client.openstack
- name: Test effective client tasks file
block:
- name: Test include case
include_tasks: ../../tasks/effective_clients_limit.yml
vars: # I am overriding this magic variable only for testing purposes
ansible_limit: 'undercloud:controller-2'
- name: Fail if include case has an unxpected value
fail:
msg: "tripleo_ceph_client_effective_clients returned
'{{ tripleo_ceph_client_effective_clients }}'
instead of ['controller-2']"
when: tripleo_ceph_client_effective_clients != ['controller-2']
- name: reset facts
set_fact:
tripleo_ceph_client_exclude: []
tripleo_ceph_client_include: []
- name: Test exclude case
include_tasks: ../../tasks/effective_clients_limit.yml
vars: # I am overriding this magic variable only for testing purposes
ansible_limit: 'undercloud:!controller-2'
- name: Fail if exclude case has an unxpected value
fail:
msg: "tripleo_ceph_client_effective_clients returned
'{{ tripleo_ceph_client_effective_clients }}' instead
of ['compute-0', 'controller-0', 'controller-1']"
when: tripleo_ceph_client_effective_clients | sort !=
['compute-0', 'controller-0', 'controller-1'] | sort
- name: reset facts
set_fact:
tripleo_ceph_client_exclude: []
tripleo_ceph_client_include: []
- name: Test include/exclude case
include_tasks: ../../tasks/effective_clients_limit.yml
vars: # I am overriding this magic variable only for testing purposes
ansible_limit: 'undercloud,!controller-2,controller-1'
- name: Fail if include/exclude case has an unxpected value
fail:
msg: "tripleo_ceph_client_effective_clients returned
'{{ tripleo_ceph_client_effective_clients }}'
instead of ['controller-1']"
when: tripleo_ceph_client_effective_clients != ['controller-1']
vars:
client_group:
- controller-0
- controller-1
- controller-2
- compute-0