From 110049e82553e94f808e532c98f2248c0f5ff77c Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Wed, 5 Dec 2018 15:15:02 -0800 Subject: [PATCH] playbook: report storage device inventory Signed-off-by: Noah Watkins --- .../storage-inventory.yml | 35 +++++++++++++++++++ tox.ini | 17 ++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 infrastructure-playbooks/storage-inventory.yml diff --git a/infrastructure-playbooks/storage-inventory.yml b/infrastructure-playbooks/storage-inventory.yml new file mode 100644 index 000000000..f4cb3fed5 --- /dev/null +++ b/infrastructure-playbooks/storage-inventory.yml @@ -0,0 +1,35 @@ +--- +# This playbook queries each OSD using `ceph-volume inventory` to report the +# entire storage device inventory of a cluster. +# +# Usage: +# ansible-playbook storage-inventory.yml + +- name: gather facts and check the init system + + hosts: + - "{{ osd_group_name|default('osds') }}" + + become: true + + tasks: + - debug: msg="gather facts on all Ceph hosts for following reference" + +- name: query each host for storage device inventory + + hosts: + - "{{ osd_group_name|default('osds') }}" + + become: true + + tasks: + - import_role: + name: ceph-defaults + + - name: list storage inventory + ceph_volume: + action: "inventory" + environment: + CEPH_VOLUME_DEBUG: 1 + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_BINARY: "{{ container_binary }}" diff --git a/tox.ini b/tox.ini index 61a64b553..533b3ae9f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {dev,luminous,mimic,rhcs}-{xenial_cluster,centos7_cluster,cluster,docker_cluster,update_cluster,update_docker_cluster,switch_to_containers,ooo_collocation,bluestore_lvm_osds,bluestore_lvm_osds_container,lvm_osds,purge_lvm_osds,purge_lvm_osds_container,shrink_mon,shrink_osd,shrink_mon_container,shrink_osd_container,docker_cluster_collocation,lvm_batch,lvm_osds_container,lvm_batch_container,infra_lv_create,add_osds,add_osds_container,rgw_multisite,rgw_multisite_container,container_podman} +envlist = {dev,luminous,mimic,rhcs}-{xenial_cluster,centos7_cluster,cluster,docker_cluster,update_cluster,update_docker_cluster,switch_to_containers,ooo_collocation,bluestore_lvm_osds,bluestore_lvm_osds_container,lvm_osds,purge_lvm_osds,purge_lvm_osds_container,shrink_mon,shrink_osd,shrink_mon_container,shrink_osd_container,docker_cluster_collocation,lvm_batch,lvm_osds_container,lvm_batch_container,infra_lv_create,add_osds,add_osds_container,rgw_multisite,rgw_multisite_container,container_podman,storage_inventory,storage_inventory_container} infra_lv_create skipsdist = True @@ -187,6 +187,13 @@ commands= bash -c "cd {changedir}/secondary && vagrant destroy --force" ansible -i localhost, all -c local -b -m iptables -a 'chain=FORWARD protocol=tcp source=192.168.0.0/16 destination=192.168.0.0/16 jump=ACCEPT action=insert rule_num=1 state=absent' +[storage-inventory] +commands= + cp {toxinidir}/infrastructure-playbooks/storage-inventory.yml {toxinidir}/storage-inventory.yml + ansible-playbook -vv -i {changedir}/hosts {toxinidir}/storage-inventory.yml --extra-vars "\ + ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-master} \ + " + [testenv] whitelist_externals = vagrant @@ -224,6 +231,8 @@ setenv= shrink_osd_container: COPY_ADMIN_KEY = True shrink_osd: COPY_ADMIN_KEY = True container_podman: PLAYBOOK = site-docker.yml.sample + storage_inventory: COPY_ADMIN_KEY = True + storage_inventory_container: PLAYBOOK = site-docker.yml.sample rhcs: CEPH_STABLE_RELEASE = luminous luminous: CEPH_STABLE_RELEASE = luminous @@ -286,6 +295,8 @@ changedir= rgw_multisite: {toxinidir}/tests/functional/centos/7/rgw-multisite rgw_multisite_container: {toxinidir}/tests/functional/centos/7/rgw-multisite-container container_podman: {toxinidir}/tests/functional/fedora/29/container-podman + storage_inventory: {toxinidir}/tests/functional/centos/7/lvm-osds + storage_inventory_container: {toxinidir}/tests/functional/centos/7/lvm-osds-container commands= rhcs: ansible-playbook -vv -i "localhost," -c local {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "change_dir={changedir}" --tags "vagrant_setup" @@ -315,6 +326,8 @@ commands= switch_to_containers: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/lvm_setup.yml container_podman: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/lvm_setup.yml container_podman: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/simulate_rhel8.yml + storage_inventory: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/lvm_setup.yml + storage_inventory_container: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/lvm_setup.yml rhcs: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} repo_url={env:REPO_URL:} rhel7_repo_url={env:RHEL7_REPO_URL:}" --skip-tags "vagrant_setup" @@ -378,5 +391,7 @@ commands= add_osds_container: {[add-osds]commands} rgw_multisite: {[rgw-multisite]commands} rgw_multisite_container: {[rgw-multisite]commands} + storage_inventory: {[storage-inventory]commands} + storage_inventory_container: {[storage-inventory]commands} vagrant destroy --force