4 # Useful for taking the first snapshot of a new rootnode
7 - name: target_rootnode
12 default: 'base-configuration'
15 - ../vars/ci-instances.yml
17 # - Set a maintenance on the jenkins node
18 # - Wait until the task is done
19 # - Maybe interrupt the jenkins tasks
20 - name: Revert target rootnode
22 ansible.builtin.command:
23 argv: ['virsh', 'snapshot-revert', "{{target_rootnode}}", '--snapshotname', "{{snapshot_name}}", '--running']
24 delegate_to: "{{rootnode_host}}"
25 - name: Wait for target rootnode to come back online
26 local_action: wait_for host={{ target_rootnode }}
31 - ansible.builtin.pause:
32 prompt: "Run any playbooks or make other changes against {{target_rootnode}} then hit enter when ready to continue (Ctrl-C to abort)"
33 - name: Remove the jenkins workspace
39 - /home/jenkins/workspace
40 delegate_to: "{{target_rootnode}}"
42 ansible.builtin.command:
43 argv: ['virsh', 'destroy', "{{target_rootnode}}"]
44 delegate_to: "{{rootnode_host}}"
45 - name: Check for existing base snapshot
46 ansible.builtin.shell:
47 cmd: "virsh snapshot-list '{{target_rootnode}}' --name | grep -E '^{{snapshot_name}}$'"
49 register: existing_snapshot
50 delegate_to: "{{rootnode_host}}"
51 - name: Remove existing base snapshot
52 when: existing_snapshot.rc == 0
53 ansible.builtin.command:
54 argv: ['virsh', 'snapshot-delete', '--snapshotname', "{{snapshot_name}}", "{{target_rootnode}}"]
55 delegate_to: "{{rootnode_host}}"
57 ansible.builtin.command:
58 argv: ['virsh', 'snapshot-create-as', '--name', "{{snapshot_name}}", "{{target_rootnode}}"]
59 delegate_to: "{{rootnode_host}}"
61 ansible.builtin.command:
62 argv: ['virsh', 'start', "{{target_rootnode}}"]
63 delegate_to: "{{rootnode_host}}"
64 # - Remove maintenance on the jenkins node