Role - tripleo_ceph_client¶
Role Documentation¶
Welcome to the “tripleo_ceph_client” role documentation.
Role Defaults¶
This section highlights all of the defaults and variables set within the “tripleo_ceph_client” role.
# All variables intended for modification should be placed in this file.
# All variables within this role should have a prefix of "tripleo_ceph_client"
tripleo_ceph_client_debug: '{{ (ansible_verbosity | int) >= 2 | bool }}'
tripleo_ceph_client_hide_sensitive_logs: true
tripleo_ceph_client_config_home: /etc/ceph
tripleo_ceph_client_fetch_dir: '{{ playbook_dir }}/ceph_client_fetch_dir'
tripleo_ceph_client_cluster: ceph
tripleo_ceph_client_fsid: ''
tripleo_ceph_client_mon_ips: []
tripleo_ceph_client_keys: []
tripleo_ceph_client_config_overrides: {}
tripleo_ceph_client_rbd_admin_socket_path: /var/run/ceph
tripleo_ceph_client_rbd_log_path: /var/log/ceph
tripleo_ceph_client_rbd_log_file: '{{ tripleo_ceph_client_rbd_log_path }}/qemu-guest-$pid.log'
external_cluster_mon_ips: ''
Molecule Scenarios¶
Molecule is being used to test the “tripleo_ceph_client” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.
- Driver: podman
Scenario: default¶
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
vars:
ansible_user: root
Example default playbook¶
- 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