Skip to content

Commit a1e6798

Browse files
cjeanneropenshift-merge-bot[bot]
authored andcommitted
Allow custom VM template
This introduces a new parameter in libvirt_manager, allowing to use another template than the current one. This parameter is intended for advanced use, and will enable further features, such as OCP node provisioning.
1 parent 5495ef3 commit a1e6798

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

roles/libvirt_manager/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Used for checking if:
1919
* `cifmw_libvirt_manager_user`: (String) User used for libvirt. Default: the one in the environment variable `USER`.
2020
* `cifmw_libvirt_manager_images_url`: (String) Location basedir for the image URI. Defaults to `https://cloud.centos.org/centos/9-stream/x86_64/images`.
2121
* `cifmw_libvirt_manager_configuration`: (Dict) Structure describing the libvirt layout (networking and VMs).
22+
* `cifmw_libvirt_manager_vm_template`: (String) Template name to use to define the virtual machines. Defaults to `domain.xml.j2`. Advanced use only.
2223
* `cifmw_libvirt_manager_crc_pool`: (String) CRC pool machine location. Defaults to `cifmw_crc_pool` which defaults to `~/.crc/machines/crc`.
2324
* `cifmw_libvirt_manager_pool_dir`: (String) Pool directory. Defaults to `cifmw_libvirt_manager_basedir/volumes`.Advanced use only.
2425
* `cifmw_libvirt_manager_installyamls`: (String) install_yamls repository location. Defaults to `cifmw_installyamls_repos` which defaults to `../..`

roles/libvirt_manager/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ cifmw_libvirt_manager_basedir: "{{ cifmw_basedir | default( ansible_user_dir ~ '
2222
cifmw_libvirt_manager_enable_virtualization_module: false
2323
cifmw_libvirt_manager_user: "{{ ansible_user | default(lookup('env', 'USER')) }}"
2424
cifmw_libvirt_manager_images_url: https://cloud.centos.org/centos/9-stream/x86_64/images
25+
cifmw_libvirt_manager_vm_template: "domain.xml.j2"
2526

2627
cifmw_libvirt_manager_compute_amount: 1
2728
cifmw_libvirt_manager_compute_disksize: 20

roles/libvirt_manager/tasks/create_vms.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
- name: "Define VMs with default template for type {{ vm_type }}"
8787
community.libvirt.virt:
8888
command: define
89-
xml: "{{ lookup('template', 'domain.xml.j2') }}"
89+
xml: "{{ lookup('template', cifmw_libvirt_manager_vm_template) }}"
9090
uri: "qemu:///system"
9191
loop: "{{ range(0, vm_data.value.amount | default(1) | int) }}"
9292
loop_control:

0 commit comments

Comments
 (0)