2022-05-12 23:22:54 +08:00
|
|
|
[tox]
|
|
|
|
envlist = centos-{container,non_container}-rbdmirror
|
|
|
|
|
|
|
|
skipsdist = True
|
|
|
|
|
|
|
|
[testenv]
|
|
|
|
allowlist_externals =
|
|
|
|
vagrant
|
|
|
|
bash
|
|
|
|
git
|
|
|
|
pip
|
|
|
|
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_CALLBACK_WHITELIST = profile_tasks
|
|
|
|
ANSIBLE_CACHE_PLUGIN = memory
|
|
|
|
ANSIBLE_GATHERING = implicit
|
2024-02-14 00:49:20 +08:00
|
|
|
ANSIBLE_COLLECTIONS_PATH = {envdir}/ansible_collections
|
2022-05-12 23:22:54 +08:00
|
|
|
# only available for ansible >= 2.5
|
|
|
|
ANSIBLE_KEEP_REMOTE_FILES = 1
|
|
|
|
ANSIBLE_STDOUT_CALLBACK = yaml
|
|
|
|
# non_container: DEV_SETUP = True
|
|
|
|
# Set the vagrant box image to use
|
2023-06-02 17:34:15 +08:00
|
|
|
centos-non_container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9
|
|
|
|
centos-container: CEPH_ANSIBLE_VAGRANT_BOX = centos/stream9
|
2022-05-12 23:22:54 +08:00
|
|
|
|
|
|
|
INVENTORY = {env:_INVENTORY:hosts}
|
|
|
|
container: CONTAINER_DIR = /container
|
|
|
|
container: PLAYBOOK = site-container.yml.sample
|
|
|
|
non_container: PLAYBOOK = site.yml.sample
|
|
|
|
container: CEPH_RBD_MIRROR_REMOTE_MON_HOSTS = 192.168.144.10
|
|
|
|
non_container: CEPH_RBD_MIRROR_REMOTE_MON_HOSTS = 192.168.140.10
|
|
|
|
|
|
|
|
UPDATE_CEPH_DOCKER_IMAGE_TAG = latest-main
|
|
|
|
UPDATE_CEPH_DEV_BRANCH = main
|
|
|
|
UPDATE_CEPH_DEV_SHA1 = latest
|
|
|
|
ROLLING_UPDATE = True
|
|
|
|
deps= -r{toxinidir}/tests/requirements.txt
|
|
|
|
changedir={toxinidir}/tests/functional/rbdmirror{env:CONTAINER_DIR:}
|
|
|
|
commands=
|
|
|
|
ansible-galaxy install -r {toxinidir}/requirements.yml -v
|
|
|
|
bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}
|
|
|
|
bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
|
|
|
|
|
2024-02-18 18:50:29 +08:00
|
|
|
non_container: ansible-playbook -vv --diff -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup"
|
2022-05-12 23:22:54 +08:00
|
|
|
|
2024-02-18 18:50:29 +08:00
|
|
|
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/setup.yml
|
2022-05-12 23:22:54 +08:00
|
|
|
|
|
|
|
# configure lvm
|
2024-02-18 18:50:29 +08:00
|
|
|
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/lvm_setup.yml
|
2022-05-12 23:22:54 +08:00
|
|
|
|
2024-02-18 18:50:29 +08:00
|
|
|
ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
|
2022-05-12 23:22:54 +08:00
|
|
|
ceph_rbd_mirror_configure=true \
|
|
|
|
ceph_rbd_mirror_pool=rbd \
|
|
|
|
ceph_rbd_mirror_local_user_secret=AQC+eM1iKKBXFBAAVpunJvqpkodHSYmljCFCnw== \
|
|
|
|
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} \
|
|
|
|
"
|
|
|
|
|
|
|
|
bash -c "cd {changedir}/secondary && bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}"
|
|
|
|
bash -c "cd {changedir}/secondary && bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}/secondary"
|
|
|
|
ansible-playbook --ssh-common-args='-F {changedir}/secondary/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey' -vv -i {changedir}/secondary/hosts {toxinidir}/tests/functional/setup.yml
|
2024-02-18 18:50:29 +08:00
|
|
|
ansible-playbook -vv --diff -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir}/secondary ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup"
|
2022-05-12 23:22:54 +08:00
|
|
|
ansible-playbook --ssh-common-args='-F {changedir}/secondary/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey' -vv -i {changedir}/secondary/hosts {toxinidir}/tests/functional/lvm_setup.yml
|
|
|
|
# ensure the rule isn't already present
|
|
|
|
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'
|
|
|
|
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=present'
|
|
|
|
ansible-playbook --ssh-common-args='-F {changedir}/secondary/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey' -vv -i {changedir}/secondary/hosts {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
|
|
|
|
yes_i_know=true \
|
|
|
|
ceph_rbd_mirror_configure=true \
|
|
|
|
ceph_rbd_mirror_pool=rbd \
|
|
|
|
ceph_rbd_mirror_remote_user=client.rbd-mirror-peer \
|
|
|
|
ceph_rbd_mirror_remote_mon_hosts={env:CEPH_RBD_MIRROR_REMOTE_MON_HOSTS} \
|
|
|
|
ceph_rbd_mirror_remote_key=AQC+eM1iKKBXFBAAVpunJvqpkodHSYmljCFCnw== \
|
|
|
|
ceph_rbd_mirror_remote_cluster=remote \
|
|
|
|
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} \
|
|
|
|
"
|
2024-02-18 18:50:29 +08:00
|
|
|
ansible-playbook -vv --diff -i {changedir}/hosts {toxinidir}/tests/functional/rbdmirror.yml --skip-tags=secondary --extra-vars "\
|
2022-05-12 23:22:54 +08:00
|
|
|
ceph_rbd_mirror_pool=rbd \
|
|
|
|
"
|
|
|
|
ansible-playbook --ssh-common-args='-F {changedir}/secondary/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey' -vv -i {changedir}/secondary/hosts {toxinidir}/tests/functional/rbdmirror.yml --skip-tags=primary -e 'ceph_rbd_mirror_pool=rbd'
|
|
|
|
vagrant destroy --force
|
|
|
|
bash -c "cd {changedir}/secondary && vagrant destroy --force"
|
|
|
|
# clean rule after the scenario is complete
|
|
|
|
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'
|
|
|
|
|
|
|
|
|