11---
22libvirt_domain :
33 # basic arguments
4+ type : " kvm"
45 groups : [] # names of Ansible nodes/groups used to provision the domain
5- name : # name/uuid of the domain (empty means new uuid)
6- title : ' ' # title of the vm
7- description : ' ' # description of the vm
8- apt_mirror : ' '
6+ name : " {{ inventory_hostname }} " # name/uuid of the domain (empty means new uuid)
7+ title : " " # title of the vm
8+ description : " " # description of the vm
9+ apt_mirror : " "
910 # note: if you do not provide a domain_id each run will create a new vm!
1011
1112 # host access ports
@@ -21,27 +22,27 @@ libvirt_domain:
2122 vm :
2223 memory : " 512MiB" # RAM memory available to the VM
2324 vcpu : 1 # number of cores designated to the VM
24- vcpu_placement : ' static' # options 'auto', 'static', defaults to 'numatune'
25+ vcpu_placement : " static" # options 'auto', 'static', defaults to 'numatune'
2526 vcpu_cpuset : [] # list of host CPU numbers the VM can run on
26- networks : [' default' ] # libvirts id of networks this VM is part of
27+ networks : [" default" ] # libvirts id of networks this VM is part of
2728 disk_size : " 12G" # use this to change first disk size
28- features : [' acpi', ' apic', ' pae' ] # vm features available
29+ features : [" acpi", " apic", " pae" ] # vm features available
2930
3031 # features
31- serial_console : yes # make a console on serial port 0 available
32- vnc : no
33- autostart : yes # should the domain VM start after reboot of the host
32+ serial_console : true # make a console on serial port 0 available
33+ vnc : false
34+ autostart : true # should the domain VM start after reboot of the host
3435
3536 # Valid install_types:
36- install_type : ' base-image' # way to install the VM (this only affects the first run!)
37+ install_type : " base-image" # way to install the VM (this only affects the first run!)
3738
3839 #
3940 # 1. 'base-image'
4041 # ----------
4142 # a simple image
4243 base_image :
4344 path : # path to the cloud image for the domain
44- mode : ' snapshot' # options: snapshot, copy
45+ mode : " snapshot" # options: snapshot, copy
4546
4647 extra_disks : []
4748 # - id: 'data-disk' # logical name of the disk (required)
@@ -56,7 +57,7 @@ libvirt_domain:
5657 # lvm_group: '' # name of volume group (required)
5758
5859 # cloud initialisation method
59- init_mode : ' cloud-config' # options: cloud-config, configdrive (empty will skip any initialisation)
60+ init_mode : " cloud-config" # options: cloud-config, configdrive (empty will skip any initialisation)
6061
6162 #
6263 # Cloud-Config
@@ -67,14 +68,16 @@ libvirt_domain:
6768 # see https://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/examples/cloud-config-user-groups.txt
6869 cloud_config :
6970 users :
70- - name : ' ubuntu'
71- gecos : ' Ubuntu'
72- ssh-authorized-keys : [] # required!
73- shell : ' /bin/bash'
74- sudo : ' ALL=(ALL) NOPASSWD:ALL'
75- groups : ' adm,audio,cdrom,dialout,floppy,video,plugdev,dip,netdev' # comma separated string!
71+ - name : " ubuntu"
72+ gecos : " Ubuntu"
73+ ssh_authorized_keys : [] # required!
74+ shell : " /bin/bash"
75+ sudo : " ALL=(ALL) NOPASSWD:ALL"
76+ groups : " adm,audio,cdrom,dialout,floppy,video,plugdev,dip,netdev" # comma separated string!
7677 bootcmd : []
77- timezone : ' ' # like Europe/Berlin
78+ timezone : " " # like Europe/Berlin
79+ packages :
80+ - python
7881
7982 #
8083 # ConfigDrive
@@ -85,7 +88,8 @@ libvirt_domain:
8588 #
8689 # all the options intended to show up in the configdrive meta_data.json
8790 configdrive :
88- meta_data : ' '
91+ meta_data :
92+ " "
8993 # hostname: '{{ libvirt_result_domain_name }}'
9094 # username: 'Admin'
9195 # groups: 'Administrators' # comma separated string!
@@ -94,15 +98,15 @@ libvirt_domain:
9498 # authorized_keys: ...
9599
96100 # content of the user data (skipped if empty)
97- user_data : ' '
101+ user_data : " "
98102 # executed for content of first line
99103 # #ps1 => Powershell
100104 # rem cmd => Cmd/Batch
101105 # #! => Bash (if installed)
102106
103- # extra file structure inside the configdrive
104- # extra_files:
105- # filename: text content
107+ # # extra file structure inside the configdrive
108+ # extra_files:
109+ # filename: text content
106110
107111 # libvirt os settings - see: https://libvirt.org/formatdomain.html#elementsOS
108112 os : " {{ libvirt_os_virtualized_x86_64 }}"
@@ -127,8 +131,9 @@ libvirt_domain:
127131 # - 'smx' # feature with default policy 'require'
128132
129133# basic arguments
134+ libvirt_domain_type : " {{ libvirt_domain.type | default('kvm', true) }}"
130135libvirt_domain_groups : " {{ libvirt_domain.groups | default([], true) }}" # names of Ansible nodes/groups used to provision the domain
131- libvirt_domain_name : " {{ libvirt_domain.name | default('' , true) }}" # name/uuid of the domain (empty means new uuid)
136+ libvirt_domain_name : " {{ libvirt_domain.name | default(inventory_hostname , true) }}" # name/uuid of the domain (empty means new uuid)
132137libvirt_domain_title : " {{ libvirt_domain.title | default('', true) }}" # title of the vm
133138libvirt_domain_description : " {{ libvirt_domain.description | default('', true) }}" # description of the vm
134139# note: if you do not provide a domain_id each run will create a new vm!
@@ -144,7 +149,8 @@ libvirt_winrm_port: "{{ (libvirt_domain.host_ports | default({}, true)).winrm |
144149# default VM configuration
145150libvirt_vm_memory : " {{ (libvirt_domain.vm | default({}, true)).memory | default('512MiB', true) }}" # RAM memory available to the VM
146151libvirt_vm_vcpu : " {{ (libvirt_domain.vm | default({}, true)).vcpu | default('1', true) }}" # number of cores designated to the VM
147- libvirt_vm_vcpu_placement : " {{ (libvirt_domain.vm | default({}, true)).vcpu_placement | default('static', true) }}" # options 'auto', 'static', defaults to 'numatune'
152+ # options 'auto', 'static', defaults to 'numatune'
153+ libvirt_vm_vcpu_placement : " {{ (libvirt_domain.vm | default({}, true)).vcpu_placement | default('static', true) }}"
148154libvirt_vm_vcpu_cpuset : " {{ (libvirt_domain.vm | default({}, true)).vcpu_cpuset | default([], true) }}" # list of host CPU numbers the VM can run on
149155libvirt_vm_networks : " {{ (libvirt_domain.vm | default({}, true)).networks | default(['default'], true) }}" # libvirts id of networks this VM is part of
150156libvirt_vm_disk_size : " {{ (libvirt_domain.vm | default({}, true)).disk_size | default('12G', true) }}" # use this to change first disk size
@@ -180,7 +186,7 @@ libvirt_extra_disks: "{{ libvirt_domain.extra_disks | default([], true) }}"
180186# cloud initialisation method
181187libvirt_init_mode : " {{ libvirt_domain.init_mode | default('cloud-config', true) }}" # options: cloud-config, configdrive (empty will skip any initialisation)
182188
183- libvirt_apt_mirror : " {{ libvirt_domain.apt_mirror | default('', true) }}"
189+ libvirt_apt_mirror : " {{ libvirt_domain.apt_mirror | default('', true) }}"
184190
185191#
186192# Cloud-Config
@@ -192,20 +198,30 @@ libvirt_apt_mirror: "{{ libvirt_domain.apt_mirror | default('', true) }}"
192198libvirt_cloud_config_users : " {{ (libvirt_domain.cloud_config | default({}, true)).users | default([libvirt_cloud_config_default_user], true) }}"
193199
194200libvirt_cloud_config_default_user :
195- name : ' ubuntu'
196- gecos : ' Ubuntu'
197- ssh-authorized-keys : [] # required!
198- shell : ' /bin/bash'
199- sudo : ' ALL=(ALL) NOPASSWD:ALL'
200- groups : ' adm,audio,cdrom,dialout,floppy,video,plugdev,dip,netdev' # comma separated string!
201+ name : " ubuntu"
202+ gecos : " Ubuntu"
203+ ssh_authorized_keys : [] # required!
204+ shell : " /bin/bash"
205+ sudo : " ALL=(ALL) NOPASSWD:ALL"
206+ groups : " adm,audio,cdrom,dialout,floppy,video,plugdev,dip,netdev" # comma separated string!
201207
202208libvirt_cloud_config_bootcmd : " {{ (libvirt_domain.cloud_config | default({}, true)).bootcmd | default([], true) }}"
203209
204210# example bootcmd that enables dhcp for ipv6 on ubuntu 16.04 guests
205- libvirt_cloud_config_ipv6_dhcp_bootcmd : [ cloud-init-per, once, ipv6-dhcp, "/bin/sh", "-c", "echo iface ens2 inet6 dhcp >> /etc/network/interfaces.d/51-cloud-init-ipv6.cfg" ]
211+ libvirt_cloud_config_ipv6_dhcp_bootcmd :
212+ [
213+ cloud-init-per,
214+ once,
215+ ipv6-dhcp,
216+ " /bin/sh" ,
217+ " -c" ,
218+ " echo iface ens2 inet6 dhcp >> /etc/network/interfaces.d/51-cloud-init-ipv6.cfg" ,
219+ ]
206220
207221libvirt_cloud_config_timezone : " {{ (libvirt_domain.cloud_config | default({}, true)).timezone | default('', true) }}"
208222
223+ libvirt_cloud_config_packages : " {{ (libvirt_domain.cloud_config | default({}, true)).packages | default([], true) | list }}"
224+
209225#
210226# ConfigDrive
211227# ===========
@@ -217,7 +233,7 @@ libvirt_cloud_config_timezone: "{{ (libvirt_domain.cloud_config | default({}, tr
217233libvirt_configdrive_meta_data : " {{ (libvirt_domain.configdrive | default({}, true)).meta_data | default(libvirt_configdrive_default_meta_data, true) }}"
218234
219235libvirt_configdrive_default_meta_data :
220- hostname : ' {{ libvirt_result_domain_name }}'
236+ hostname : " {{ libvirt_result_domain_name }}"
221237# username: 'Admin'
222238# groups: 'Administrators' # comma separated string!
223239# inject_user_password: True
@@ -235,17 +251,17 @@ libvirt_configdrive_user_data: "{{ (libvirt_domain.configdrive | default({}, tru
235251libvirt_configdrive_files : " {{ (libvirt_domain.configdrive | default({}, true)).extra_files | default({}, true) | combine(libvirt_configdrive_base_files) }}"
236252
237253libvirt_configdrive_base_files :
238- ' openstack/latest/meta_data.json ' : ' {{ libvirt_configdrive_meta_data | to_json }}'
239- ' openstack/latest/user_data ' : ' {{ libvirt_configdrive_user_data }}'
254+ " openstack/latest/meta_data.json " : " {{ libvirt_configdrive_meta_data | to_json }}"
255+ " openstack/latest/user_data " : " {{ libvirt_configdrive_user_data }}"
240256
241257# libvirt os settings - see: https://libvirt.org/formatdomain.html#elementsOS
242258libvirt_os_virtualized_x86_64 :
243- type : ' hvm'
244- type_arch : ' x86_64'
259+ type : " hvm"
260+ type_arch : " x86_64"
245261
246262libvirt_os_virtualized_x86 :
247- type : ' hvm'
248- type_arch : ' i686'
263+ type : " hvm"
264+ type_arch : " i686"
249265
250266libvirt_os : " {{ libvirt_domain.os | default(libvirt_os_virtualized_x86_64, true) }}"
251267# type: 'hvm' # options 'hvm'*, 'linux', 'exe'
@@ -257,12 +273,12 @@ libvirt_os: "{{ libvirt_domain.os | default(libvirt_os_virtualized_x86_64, true)
257273#
258274# use these settings for easily migratable vms (default)
259275libvirt_vm_cpu_migratable :
260- match : ' exact' # options 'minimum', 'exact', 'strict'
261- mode : ' custom' # options 'custom', 'host-model', 'host-passthrough'
276+ match : " exact" # options 'minimum', 'exact', 'strict'
277+ mode : " custom" # options 'custom', 'host-model', 'host-passthrough'
262278#
263279# use these settings for fast, supports nested virtualisation
264280libvirt_vm_cpu_fast :
265- mode : ' host-model' # everything libvirt understands
281+ mode : " host-model" # everything libvirt understands
266282
267283libvirt_vm_cpu : " {{ libvirt_domain.cpu | default(libvirt_vm_cpu_fast, true) }}"
268284# more options:
@@ -281,11 +297,11 @@ libvirt_vm_cpu: "{{ libvirt_domain.cpu | default(libvirt_vm_cpu_fast, true) }}"
281297# ssh port foward configuration
282298libvirt_ssh_base_port : 22000 # first host port for forwards to VM ssh
283299libvirt_ssh_guest_port : 22 # guest port for ssh
284- libvirt_host_ssh_ip_address : " {{ ansible_default_ipv4.address }}" # host ip address where ssh_ports are made available
300+ libvirt_host_ssh_ip_address : " {{ libvirt_host_vars. ansible_default_ipv4.address }}" # host ip address where ssh_ports are made available
285301libvirt_host_ssh_destination_any : " 0.0.0.0/0" # bind to any host ip subnet
286302libvirt_host_ssh_destination_ip : " {{ libvirt_host_ssh_ip_address }}" # bind to any host ip subnet
287303libvirt_host_ssh_destination : " {{ libvirt_host_ssh_destination_any }}" # ip subnet that is bound by port forwarding
288- libvirt_host_accept_all_ports : no # if enabled the firewall is configured to allow all ports of the vm being accessed
304+ libvirt_host_accept_all_ports : false # if enabled the firewall is configured to allow all ports of the vm being accessed
289305
290306libvirt_rdp_base_port : 33890 # first host port for forwards to VM rdp
291307libvirt_rdp_guest_port : 3389 # guest port for rdp
@@ -296,13 +312,4 @@ libvirt_winrm_guest_port: 5986 # guest port for winrm (no ssl)
296312# configuration options
297313libvirt_images_path : " /var/lib/libvirt/images" # path on the host, where all the images are stored
298314
299- # template for the stored facts hash (values are variable/fact names)
300- libvirt_domain_fact_template : >-
301- {
302- u"ssh_port": {{ libvirt_result_ssh_port }},
303- u"rdp_port": {{ libvirt_result_rdp_port }},
304- u"winrm_port": {{ libvirt_result_winrm_port }},
305- u"groups": {{ libvirt_domain_groups }}
306- }
307-
308- ansible_facts_path : ' /etc/ansible/facts.d' # path where local Ansible facts are stored & read
315+ ansible_facts_path : " /etc/ansible/facts.d" # path where local Ansible facts are stored & read
0 commit comments