mirror of https://github.com/ceph/ceph-ansible.git
ci: reboot with ansible instead of vagrant reload
vagrant is serialized and takes a lot of time compare to simple reboot. See the benchmarks below for 3 VMs: [leseb@rick docker]$ time ANSIBLE_SSH_ARGS="-F /home/leseb/reproduce-ci/tmp.zgGC7d5mIC/build/workspace/ceph-ansible/tests/functional/centos/7/docker/vagrant_ssh_config" ansible-playbook -i /home/leseb/reproduce-ci/tmp.zgGC7d5mIC/build/workspace/ceph-ansible/tests/functional/centos/7/docker/hosts reboot.yml PLAY [mons] **************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ***************************************************************************************************************************************************************************************** ok: [mon1] ok: [mon2] ok: [mon0] TASK [restart machine] ***************************************************************************************************************************************************************************************** changed: [mon2] changed: [mon1] changed: [mon0] TASK [wait for server to boot] ********************************************************************************************************************************************************************************* ok: [mon2 -> localhost] ok: [mon0 -> localhost] ok: [mon1 -> localhost] TASK [uptime] ************************************************************************************************************************************************************************************************** changed: [mon2] changed: [mon0] changed: [mon1] PLAY RECAP ***************************************************************************************************************************************************************************************************** mon0 : ok=4 changed=2 unreachable=0 failed=0 mon1 : ok=4 changed=2 unreachable=0 failed=0 mon2 : ok=4 changed=2 unreachable=0 failed=0 real 0m35.112s user 0m5.737s sys 0m1.849s [leseb@rick docker]$ time vagrant reload ==> mon0: Halting domain... ==> mon0: Starting domain. ==> mon0: Waiting for domain to get an IP address... ==> mon0: Waiting for SSH to become available... ==> mon0: Creating shared folders metadata... ==> mon0: Rsyncing folder: /home/leseb/reproduce-ci/tmp.zgGC7d5mIC/build/workspace/ceph-ansible/tests/functional/centos/7/docker/ => /home/vagrant/sync ==> mon0: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> mon0: flag to force provisioning. Provisioners marked to run always will still run. ==> mon1: Halting domain... ==> mon1: Starting domain. ==> mon1: Waiting for domain to get an IP address... ==> mon1: Waiting for SSH to become available... ==> mon1: Creating shared folders metadata... ==> mon1: Rsyncing folder: /home/leseb/reproduce-ci/tmp.zgGC7d5mIC/build/workspace/ceph-ansible/tests/functional/centos/7/docker/ => /home/vagrant/sync ==> mon1: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> mon1: flag to force provisioning. Provisioners marked to run always will still run. ==> mon2: Halting domain... ==> mon2: Starting domain. ==> mon2: Waiting for domain to get an IP address... ==> mon2: Waiting for SSH to become available... ==> mon2: Creating shared folders metadata... ==> mon2: Rsyncing folder: /home/leseb/reproduce-ci/tmp.zgGC7d5mIC/build/workspace/ceph-ansible/tests/functional/centos/7/docker/ => /home/vagrant/sync ==> mon2: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> mon2: flag to force provisioning. Provisioners marked to run always will still run. real 1m31.850s user 0m7.387s sys 0m0.796s Reboot via Ansible: 0m35.112s Reboot via vagrant: 1m31.850s We save 1/3 time. Signed-off-by: Sébastien Han <seb@redhat.com>pull/2045/head
parent
73f6aeb15f
commit
3e058bff06
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
gather_facts: true
|
||||||
|
tasks:
|
||||||
|
# why sleep 2? see here: https://github.com/ansible/ansible/issues/14413
|
||||||
|
- name: reboot the machines
|
||||||
|
shell: sleep 2 && shutdown -r now
|
||||||
|
become: yes
|
||||||
|
async: 1
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: waiting 3 minutes for the machines to come back
|
||||||
|
local_action: wait_for host={{ ansible_default_ipv4.address }} port=22 state=started delay=30 timeout=180
|
||||||
|
|
||||||
|
- name: uptime
|
||||||
|
command: uptime
|
2
tox.ini
2
tox.ini
|
@ -224,7 +224,7 @@ commands=
|
||||||
testinfra -n 8 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts {toxinidir}/tests/functional/tests
|
testinfra -n 8 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts {toxinidir}/tests/functional/tests
|
||||||
|
|
||||||
# reboot all vms
|
# reboot all vms
|
||||||
vagrant reload --no-provision
|
ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/reboot.yml
|
||||||
|
|
||||||
# wait 2 minutes for services to be ready
|
# wait 2 minutes for services to be ready
|
||||||
sleep 120
|
sleep 120
|
||||||
|
|
Loading…
Reference in New Issue