Add support for multiple disks when creating new virtual machines.
This commit is contained in:
parent
ad30e5be01
commit
a47d58799d
1 changed files with 8 additions and 2 deletions
|
@ -7,9 +7,15 @@
|
|||
- "../../vars/{{ os_type }}.yml"
|
||||
|
||||
vars:
|
||||
letters: "{{ 'bcdefghijklmnopqrstuvwxyz'|list }}"
|
||||
vmhost_uri: "qemu+ssh://root@{{ vmhost }}/system"
|
||||
root_pubkey: "{{ lookup('file', '/srv/ansible-private/ssh/id_rsa.pub') }}"
|
||||
|
||||
extra_disks: >-
|
||||
{% if datadisk_size is defined %}
|
||||
{% for num in range(datadisk_size|count) %}
|
||||
--disk /srv/libvirt/data/{{ inventory_hostname }}.{{ letters[num] }}.img,cache=none,format=raw,size={{ datadisk_size[num] }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
tasks:
|
||||
|
||||
- name: get vm list
|
||||
|
@ -54,8 +60,8 @@
|
|||
--controller usb,model=none --sound none --memory {{ mem_size }} \
|
||||
--vcpus {{ num_cpus }} --cpu host-passthrough \
|
||||
--disk /srv/libvirt/os/{{ inventory_hostname }}.a.img,cache=none,format=raw,size={{ dsk_size }} \
|
||||
{{ extra_disks }} --initrd-inject {{ tmpdir.path }}/include.ks \
|
||||
--network bridge=br20,mac={{ mac_address }},model=virtio \
|
||||
--initrd-inject {{ tmpdir.path }}/include.ks \
|
||||
{{ virt_install_os_args }}
|
||||
delegate_to: localhost
|
||||
when: inventory_hostname not in result.list_vms
|
||||
|
|
Loading…
Add table
Reference in a new issue