-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make start VM and Manage (inventory + jumper) optional
It does not make sense to add all VMs created in a lab environment to the ci-framework inventory. Also not starting VMs can be useful even for VMs that don't use a blank image. Add two fields to the "vms" definition: `start` and `manage`. A VM that is not started won't be managed, a VM can be started but not managed.
- Loading branch information
1 parent
cab0f51
commit 73e5170
Showing
6 changed files
with
55 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
...ibvirt_manager/tasks/start_manage_vms.yml → roles/libvirt_manager/tasks/manage_vms.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- name: Refresh oooq_pool before starting VMs | ||
when: | ||
- "item.value.status == 'running'" | ||
community.libvirt.virt_pool: | ||
command: refresh | ||
name: "{{ item.key }}" | ||
loop: "{{ ansible_libvirt_pools | dict2items }}" | ||
loop_control: | ||
label: "{{ item.key }}" | ||
|
||
# Start and manage VMs, such as injecting SSH configurations, | ||
# inject the VMs in the live inventory for later reference, and so on. | ||
# In case we create a "blank" VM, without any OS, it shouldn't be known by | ||
# ansible, so no access should be done. | ||
- name: "Start VMs for type {{ vm_type }}" | ||
community.libvirt.virt: | ||
state: running | ||
name: "cifmw-{{ vm_type }}-{{ vm_id }}" | ||
uri: "qemu:///system" | ||
loop: "{{ range(0, vm_data.value.amount | default(1) | int) }}" | ||
loop_control: | ||
index_var: vm_id | ||
label: "{{ vm_type }}-{{ vm_id }}" |