Add support to provision OpenBSD KVM guests
This commit is contained in:
parent
d9f009565c
commit
fc25e0a108
2 changed files with 14 additions and 2 deletions
|
@ -14,3 +14,6 @@ tls_bundle: "{{ tls_certs }}/cert.pem"
|
|||
dsk_size: 10
|
||||
mem_size: 256
|
||||
num_cpus: 1
|
||||
|
||||
# extra args for virt-install
|
||||
virt_install_os_args: --cdrom https://www.foo.sh/ks/openbsd/openbsd.iso
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
dsk_opts: bus=virtio,cache=none,device=disk,format=raw
|
||||
base: /srv/libvirt/hdd/{{ inventory_hostname }}
|
||||
|
||||
inject: >-
|
||||
{% if not '--cdrom' in virt_install_os_args %}{{ true }}{% endif %}
|
||||
|
||||
virt_install_disks: >-
|
||||
{% if datadisks is defined %}
|
||||
{% for i in range(datadisks|count) %}
|
||||
|
@ -44,7 +47,9 @@
|
|||
state: directory
|
||||
register: tmpdir
|
||||
delegate_to: localhost
|
||||
when: inventory_hostname not in result.list_vms
|
||||
when:
|
||||
- inventory_hostname not in result.list_vms
|
||||
- inject is defined
|
||||
|
||||
- name: create inject file
|
||||
copy:
|
||||
|
@ -57,7 +62,9 @@
|
|||
%end
|
||||
dest: "{{ tmpdir.path }}/include.ks"
|
||||
delegate_to: localhost
|
||||
when: inventory_hostname not in result.list_vms
|
||||
when:
|
||||
- inventory_hostname not in result.list_vms
|
||||
- inject is defined
|
||||
|
||||
- name: run virt-install
|
||||
command: >
|
||||
|
@ -69,7 +76,9 @@
|
|||
--vcpus "sockets=1,cores={{ num_cpus }},threads=1,placement=auto" \
|
||||
--memory {{ mem_size }} --cpu host-passthrough \
|
||||
--disk {{ os_disk_image }},{{ dsk_opts }},size={{ dsk_size }} \
|
||||
{% if inject -%}
|
||||
--initrd-inject {{ tmpdir.path }}/include.ks \
|
||||
{% endif -%}
|
||||
{{ virt_install_disks }} \
|
||||
{{ virt_install_network }} \
|
||||
{{ virt_install_os_args }}
|
||||
|
|
Loading…
Add table
Reference in a new issue