ceph-ansible/tox.ini

399 lines
19 KiB
INI

[tox]
envlist = centos-{container,non_container}-{all_daemons,all_daemons_ipv6,collocation,lvm_osds,shrink_mon,shrink_mgr,shrink_mds,shrink_rbdmirror,shrink_rgw,lvm_batch,add_mons,add_mgrs,add_mdss,add_rbdmirrors,add_rgws,purge,storage_inventory,lvm_auto_discovery,all_in_one,cephadm_adopt,purge_dashboard}
centos-non_container-{switch_to_containers}
infra_lv_create
migrate_ceph_disk_to_ceph_volume
flake8
skipsdist = True
# a test scenario for the lv-create.yml and lv-teardown playbooks
[testenv:infra_lv_create]
allowlist_externals =
vagrant
bash
mkdir
cat
passenv=*
setenv=
ANSIBLE_SSH_ARGS = -F {changedir}/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey
ANSIBLE_CONFIG = {toxinidir}/ansible.cfg
ANSIBLE_ACTION_PLUGINS = {toxinidir}/plugins/actions
ANSIBLE_CALLBACK_PLUGINS = {toxinidir}/plugins/callback
ANSIBLE_CALLBACK_WHITELIST = profile_tasks
# only available for ansible >= 2.5
ANSIBLE_STDOUT_CALLBACK = yaml
deps= -r{toxinidir}/tests/requirements.txt
changedir={toxinidir}/tests/functional/infra_lv_create
commands=
bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}
bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
ansible-playbook -vv --diff -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/lv-create.yml
ansible-playbook -vv --diff -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/lv-teardown.yml --extra-vars "ireallymeanit=yes"
cat {toxinidir}/infrastructure-playbooks/lv-create.log
vagrant destroy --force
# extra commands for purging clusters
# that purge the cluster and then set it up again to
# ensure that a purge can clear nodes well enough that they
# can be redployed to.
[purge]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/rbd_map_devices.yml --extra-vars "\
ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:quay.io} \
ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon-base} \
ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-main} \
"
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/{env:PURGE_PLAYBOOK:purge-cluster.yml} --extra-vars "\
ireallymeanit=yes \
remove_packages=yes \
ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:quay.io} \
ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon-base} \
ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-main} \
"
# re-setup lvm, we exclude osd2 given this node uses lvm batch scenario (see corresponding inventory host file)
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/lvm_setup.yml --limit 'osds:!osd2'
# set up the cluster again
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars @ceph-override.json --extra-vars "\
yes_i_know=true \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
# test that the cluster can be redeployed in a healthy state
py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[purge-dashboard]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/purge-dashboard.yml --extra-vars "\
ireallymeanit=yes \
ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:quay.io} \
ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon-base} \
ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-main} \
"
# set up the cluster again
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars @ceph-override.json --extra-vars "\
yes_i_know=true \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
# test that the cluster can be redeployed in a healthy state
py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[purge-lvm]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/{env:PURGE_PLAYBOOK:purge-cluster.yml} --extra-vars "\
ireallymeanit=yes \
remove_packages=yes \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/lvm_setup.yml
# set up the cluster again
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
yes_i_know=true \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
"
# test that the cluster can be redeployed in a healthy state
py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[shrink-mon]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/shrink-mon.yml --extra-vars "\
ireallymeanit=yes \
mon_to_kill={env:MON_TO_KILL:mon2} \
"
[shrink-osd]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/shrink-osd.yml --extra-vars "\
ireallymeanit=yes \
osd_to_kill={env:OSD_TO_KILL:0} \
"
[shrink-mgr]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/shrink-mgr.yml --extra-vars "\
ireallymeanit=yes \
mgr_to_kill={env:MGR_TO_KILL:mgr1} \
"
[shrink-mds]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/shrink-mds.yml --extra-vars "\
ireallymeanit=yes \
mds_to_kill={env:MDS_TO_KILL:mds0} \
"
[shrink-rbdmirror]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/shrink-rbdmirror.yml --extra-vars "\
ireallymeanit=yes \
rbdmirror_to_kill={env:RBDMIRROR_TO_KILL:rbd-mirror0} \
"
[shrink-rgw]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/shrink-rgw.yml --extra-vars "\
ireallymeanit=yes \
rgw_to_kill={env:RGW_TO_KILL:rgw0.rgw0} \
"
[switch-to-containers]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml --extra-vars "\
ireallymeanit=yes \
ceph_docker_image_tag=latest-main-devel \
ceph_docker_registry=quay.io \
ceph_docker_image=ceph/daemon-base \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-switch-to-containers --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/reboot.yml
py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-switch-to-containers --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[add-mons]
commands=
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit mon1 {toxinidir}/tests/functional/setup.yml
ansible-playbook -vv --diff -i {changedir}/hosts-2 {toxinidir}/infrastructure-playbooks/add-mon.yml --extra-vars "\
ireallymeanit=yes \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
"
py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[add-mgrs]
commands=
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit mgrs {toxinidir}/tests/functional/setup.yml
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit mgrs {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
yes_i_know=true \
ireallymeanit=yes \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
py.test --reruns 5 --reruns-delay 1 -n 8 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[add-mdss]
commands=
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit mdss {toxinidir}/tests/functional/setup.yml
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit mdss {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
yes_i_know=true \
ireallymeanit=yes \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
py.test --reruns 5 --reruns-delay 1 -n 8 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[add-rbdmirrors]
commands=
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit rbdmirrors {toxinidir}/tests/functional/setup.yml
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit rbdmirrors {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
yes_i_know=true \
ireallymeanit=yes \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
py.test --reruns 5 --reruns-delay 1 -n 8 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[add-rgws]
commands=
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit rgws {toxinidir}/tests/functional/setup.yml
ansible-playbook -vv --diff -i {changedir}/hosts-2 --limit rgws {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
yes_i_know=true \
ireallymeanit=yes \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
py.test --reruns 5 --reruns-delay 1 -n 8 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
[storage-inventory]
commands=
ansible-playbook -vv --diff -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/storage-inventory.yml --extra-vars "\
ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-main} \
"
[cephadm-adopt]
commands=
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/cephadm-adopt.yml --extra-vars "\
ireallymeanit=yes \
delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
ceph_repository=dev \
"
# idempotency test
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/cephadm-adopt.yml --extra-vars "\
ireallymeanit=yes \
delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
ceph_repository=dev \
"
[testenv]
allowlist_externals =
vagrant
bash
pip
rm
passenv=*
sitepackages=False
setenv=
ANSIBLE_SSH_ARGS = -F {changedir}/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey
ANSIBLE_CONFIG = {toxinidir}/ansible.cfg
ANSIBLE_CALLBACKS_ENABLED = profile_tasks
ANSIBLE_KEEP_REMOTE_FILES = 1
ANSIBLE_CACHE_PLUGIN = memory
ANSIBLE_GATHERING = implicit
ANSIBLE_COLLECTIONS_PATH = {envdir}/ansible_collections
# only available for ansible >= 2.5
ANSIBLE_STDOUT_CALLBACK = yaml
non_container: DEV_SETUP = True
# Set the vagrant box image to use
centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9
centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9
INVENTORY = {env:_INVENTORY:hosts}
container: CONTAINER_DIR = /container
container: PLAYBOOK = site-container.yml.sample
container: PURGE_PLAYBOOK = purge-container-cluster.yml
non_container: PLAYBOOK = site.yml.sample
shrink_mds: MDS_TO_KILL = mds0
shrink_mgr: MGR_TO_KILL = mgr1
shrink_mon: MON_TO_KILL = mon2
shrink_rbdmirror: RBDMIRROR_TO_KILL = rbd-mirror0
shrink_rgw: RGW_TO_KILL = rgw0.rgw0
CEPH_DOCKER_IMAGE_TAG = latest-main
CEPH_DOCKER_IMAGE_TAG_BIS = latest-bis-main
UPDATE_CEPH_DOCKER_IMAGE_TAG = latest-main
switch_to_containers: CEPH_DOCKER_IMAGE_TAG = latest-main-devel
deps= -r{toxinidir}/tests/requirements.txt
changedir=
all_daemons: {toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
all_daemons_ipv6: {toxinidir}/tests/functional/all_daemons_ipv6{env:CONTAINER_DIR:}
cluster: {toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
shrink_mon: {toxinidir}/tests/functional/shrink_mon{env:CONTAINER_DIR:}
shrink_mgn: {toxinidir}/tests/functional/shrink_mon{env:CONTAINER_DIR:}
shrink_mgr: {toxinidir}/tests/functional/shrink_mgr{env:CONTAINER_DIR:}
shrink_mds: {toxinidir}/tests/functional/shrink_mds{env:CONTAINER_DIR:}
shrink_rbdmirror: {toxinidir}/tests/functional/shrink_rbdmirror{env:CONTAINER_DIR:}
shrink_rgw: {toxinidir}/tests/functional/shrink_rgw{env:CONTAINER_DIR:}
# tests a 1 mon, 1 osd, 1 mds and 1 rgw centos7 cluster using docker
collocation: {toxinidir}/tests/functional/collocation{env:CONTAINER_DIR:}
purge: {toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
purge_dashboard: {toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
switch_to_containers: {toxinidir}/tests/functional/all_daemons
lvm_osds: {toxinidir}/tests/functional/lvm-osds{env:CONTAINER_DIR:}
lvm_batch: {toxinidir}/tests/functional/lvm-batch{env:CONTAINER_DIR:}
add_mons: {toxinidir}/tests/functional/add-mons{env:CONTAINER_DIR:}
add_mgrs: {toxinidir}/tests/functional/add-mgrs{env:CONTAINER_DIR:}
add_mdss: {toxinidir}/tests/functional/add-mdss{env:CONTAINER_DIR:}
add_rbdmirrors: {toxinidir}/tests/functional/add-rbdmirrors{env:CONTAINER_DIR:}
add_rgws: {toxinidir}/tests/functional/add-rgws{env:CONTAINER_DIR:}
storage_inventory: {toxinidir}/tests/functional/lvm-osds{env:CONTAINER_DIR:}
lvm_auto_discovery: {toxinidir}/tests/functional/lvm-auto-discovery{env:CONTAINER_DIR:}
all_in_one: {toxinidir}/tests/functional/all-in-one{env:CONTAINER_DIR:}
cephadm_adopt: {toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
commands=
ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections
bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}
bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
# configure lvm, we exclude osd2 given this node uses lvm batch scenario (see corresponding inventory host file)
!lvm_batch-!lvm_auto_discovery: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/lvm_setup.yml --limit 'osds:!osd2'
lvm_osds: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/lvm_setup.yml --limit 'osd2'
all_in_one: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/lvm_setup.yml
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/setup.yml
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
no_log_on_ceph_key_tasks=false \
yes_i_know=true \
ceph_dev_branch={env:CEPH_DEV_BRANCH:main} \
ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
ceph_docker_registry_auth=True \
ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
"
# test cluster state using ceph-ansible tests
py.test --reruns 20 --reruns-delay 3 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
# reboot all vms
all_daemons,all_daemons_ipv6,collocation: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/reboot.yml
# retest to ensure cluster came back up correctly after rebooting
all_daemons,all_daemons_ipv6,collocation: py.test --reruns 20 --reruns-delay 3 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
# handlers/idempotency test
all_daemons,all_daemon_ipv6,all_in_one,collocation: ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "no_log_on_ceph_key_tasks=false delegate_facts_host={env:DELEGATE_FACTS_HOST:True} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG_BIS:latest-bis-main} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} yes_i_know=true" --extra-vars @ceph-override.json
purge: {[purge]commands}
purge_dashboard: {[purge-dashboard]commands}
switch_to_containers: {[switch-to-containers]commands}
shrink_mon: {[shrink-mon]commands}
shrink_mgr: {[shrink-mgr]commands}
shrink_mds: {[shrink-mds]commands}
shrink_rbdmirror: {[shrink-rbdmirror]commands}
shrink_rgw: {[shrink-rgw]commands}
add_mons: {[add-mons]commands}
add_mgrs: {[add-mgrs]commands}
add_mdss: {[add-mdss]commands}
add_rbdmirrors: {[add-rbdmirrors]commands}
add_rgws: {[add-rgws]commands}
storage_inventory: {[storage-inventory]commands}
cephadm_adopt: {[cephadm-adopt]commands}
vagrant destroy --force
[testenv:flake8]
max-line-length = 100
ignore =
E501,
W503,
exclude =
.tox \
.vagrant \
__pycache__ \
*.pyc \
templates \
.eggs
statistics = True
deps =
flake8
commands =
flake8 --max-line-length=160 ./library ./module_utils/ ./tests/library/ ./tests/module_utils/ ./tests/functional/tests/ {posargs}