c25d223c7b
* added license templates for go, bash & yaml in tools dir * added a script that will add license information for all missing files. Type: go, yaml, yml, sh * skip adding license for all files within testdata * Syntax: > ./tools/add_license.sh * Skip license for manifests folder * Added one extra line after licene for yaml files * Added License after Hashbang for bash. * Add an extra line after hashbang and before license * Updated the go template to use multiline comments New Files: 1. tools/add_license.sh 2. tools/license_go.txt 3. tools/license_yaml.txt 4. tools/license_bash.txt Change-Id: Ia4da5b261e7cd518d446896b72c810421877472a Realtes-To:#147
186 lines
6.6 KiB
YAML
186 lines
6.6 KiB
YAML
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
---
|
|
|
|
# The default directory in which to store VM console logs, if a VM-specific log
|
|
# file path is not given.
|
|
libvirt_vm_default_console_log_dir: "/var/log/libvirt-consoles"
|
|
|
|
# The default location for libvirt images
|
|
libvirt_volume_default_images_path: '/var/lib/libvirt/images'
|
|
|
|
# Default type for Libvirt volumes
|
|
libvirt_volume_default_type: volume
|
|
|
|
# The default format for Libvirt volumes.
|
|
libvirt_volume_default_format: qcow2
|
|
|
|
# The default device for Libvirt volumes.
|
|
libvirt_volume_default_device: disk
|
|
|
|
# CPU architecture.
|
|
libvirt_vm_arch: x86_64
|
|
|
|
# Virtualisation engine. If not set, the role will attempt to auto-detect the
|
|
# optimal engine to use.
|
|
libvirt_vm_engine:
|
|
|
|
# Path to emulator binary. If not set, the role will attempt to auto-detect the
|
|
# correct emulator to use.
|
|
libvirt_vm_emulator:
|
|
|
|
# Default value for clock syncing. The default (false) uses <clock sync="localtime">
|
|
# to configure the instances clock synchronisation. Change to a timezone to make
|
|
# configuration use <clock offset="specified offset">
|
|
libvirt_vm_clock_offset: False
|
|
|
|
# A list of specifications of VMs to be created.
|
|
# For backwards compatibility, libvirt_vms defaults to a singleton list using
|
|
# the values of the deprecated variables below.
|
|
# See README.md or tasks/main.yaml for these attributes' defaults.
|
|
libvirt_domain:
|
|
# State of the VM. May be 'present' or 'absent'.
|
|
state: "{{ libvirt_vm_state }}"
|
|
|
|
# Name of the VM.
|
|
name: "{{ libvirt_vm_name }}"
|
|
|
|
# Memory in MB.
|
|
memory_mb: "{{ libvirt_vm_memory_mb }}"
|
|
|
|
# Number of vCPUs.
|
|
vcpus: "{{ libvirt_vm_vcpus }}"
|
|
|
|
# Virtual machine type.
|
|
machine: "{{ libvirt_vm_machine }}"
|
|
|
|
# Virtual machine CPU mode.
|
|
cpu_mode: "{{ libvirt_vm_cpu_mode | default(libvirt_cpu_mode_default, true) }}"
|
|
|
|
# List of volumes.
|
|
volumes: "{{ libvirt_vm_volumes }}"
|
|
|
|
# What time should the clock be synced to on boot (utc/localtime/timezone/variable)
|
|
clock_offset: "localtime"
|
|
|
|
# List of network interfaces.
|
|
interfaces: "{{ libvirt_vm_interfaces }}"
|
|
|
|
# Path to console log file.
|
|
console_log_path: "{{ libvirt_vm_console_log_path }}"
|
|
|
|
# XML template file to source domain definition
|
|
xml_file: vm.xml.j2
|
|
|
|
# Variables to add to the enviroment that is used to execute virsh commands
|
|
libvirt_vm_virsh_default_env: "{{ { 'LIBVIRT_DEFAULT_URI': libvirt_vm_uri } if libvirt_vm_uri else {} }}"
|
|
|
|
# Override for the libvirt connection uri. Leave unset to use the default.
|
|
libvirt_vm_uri: ""
|
|
|
|
# Default CPU mode if libvirt_vm_cpu_mode or vm.cpu_mode is undefined
|
|
libvirt_cpu_mode_default: "{{ 'host-passthrough' if libvirt_vm_engine == 'kvm' else 'host-model' }}"
|
|
|
|
libvirt_domain_template_default: |
|
|
<domain type='{{ libvirt_vm_engine }}'>
|
|
<name>{{ libvirt_domain.name }}</name>
|
|
<memory>{{ libvirt_domain.memory_mb | int * 1024 }}</memory>
|
|
<vcpu>{{ libvirt_domain.vcpus }}</vcpu>
|
|
{% if libvirt_domain.clock_offset |default( libvirt_vm_clock_offset ) %}
|
|
<clock offset="{{ libvirt_domain.clock_offset }}"/>
|
|
{% else %}
|
|
<clock sync="localtime"/>
|
|
{% endif %}
|
|
<on_poweroff>destroy</on_poweroff>
|
|
<on_reboot>restart</on_reboot>
|
|
<on_crash>destroy</on_crash>
|
|
<os>
|
|
<type arch='{{ libvirt_vm_arch }}'{% if machine is not none %} machine='{{ machine }}'{% endif %}>hvm</type>
|
|
<bootmenu enable='no'/>
|
|
<boot dev='hd'/>
|
|
<boot dev='cdrom'/>
|
|
<boot dev='network'/>
|
|
<bios useserial='yes'/>
|
|
</os>
|
|
<features>
|
|
<acpi/>
|
|
<apic/>
|
|
<pae/>
|
|
</features>
|
|
{% if cpu_mode %}
|
|
<cpu mode='{{ cpu_mode }}'>
|
|
<model fallback='allow'/>
|
|
</cpu>
|
|
{% endif %}
|
|
<devices>
|
|
<emulator>{{ libvirt_vm_emulator }}</emulator>
|
|
{% for volume in volumes %}
|
|
<disk type='{{ volume.type | default(libvirt_volume_default_type) }}' device='{{ volume.device | default(libvirt_volume_default_device) }}'>
|
|
<driver name='qemu' type='{{ volume.format | default(libvirt_volume_default_format) }}'/>
|
|
{% if volume.type | default(libvirt_volume_default_type) == 'file' %}
|
|
<source file='{{ volume.file_path |default(libvirt_volume_default_images_path) }}/{{ volume.name}}'/>
|
|
{% else %}
|
|
<source pool='{{ volume.pool }}' volume='{{ volume.name }}'/>
|
|
{% endif %}
|
|
{% if volume.target is undefined %}
|
|
<target dev='vd{{ 'abcdefghijklmnopqrstuvwxyz'[loop.index - 1] }}'/>
|
|
{% else %}
|
|
<target dev='{{ volume.target }}' />
|
|
{% endif %}
|
|
</disk>
|
|
{% endfor %}
|
|
{% for interface in interfaces %}
|
|
{% if interface.type is defined and interface.type == 'direct' %}
|
|
<interface type='direct'>
|
|
<source dev='{{ interface.source.dev }}' mode='{{ interface.source.mode | default('vepa') }}'/>
|
|
{% elif interface.type is defined and interface.type == 'bridge' %}
|
|
<interface type='bridge'>
|
|
<source bridge='{{ interface.source.dev }}'/>
|
|
{% elif interface.type is not defined or interface.type == 'network' %}
|
|
<interface type='network'>
|
|
<source network='{{ interface.network }}'/>
|
|
{% endif %}
|
|
{% if interface.mac is defined %}
|
|
<mac address='{{ interface.mac }}'/>
|
|
{% endif %}
|
|
{# if the network configuration is invalid this can still appear in the xml #}
|
|
{# (say you enter 'bond' instead of 'bridge' in your variables) #}
|
|
<model type='virtio'/>
|
|
</interface>
|
|
{% endfor %}
|
|
{% if console_log_enabled | bool %}
|
|
<serial type='file'>
|
|
<source path='{{ console_log_path }}'/>
|
|
</serial>
|
|
<serial type='pty'/>
|
|
<console type='file'>
|
|
<source path='{{ console_log_path }}'/>
|
|
<target type='serial'/>
|
|
</console>
|
|
{% else %}
|
|
<serial type='pty'>
|
|
<target port='0'/>
|
|
</serial>
|
|
<console type='pty'>
|
|
<target type='serial' port='0'/>
|
|
</console>
|
|
{% endif %}
|
|
{% if enable_vnc |bool %}
|
|
<graphics type='vnc' autoport='yes' listen='0.0.0.0'>
|
|
<listen type='address' address='0.0.0.0'/>
|
|
</graphics>
|
|
{% endif %}
|
|
<rng model="virtio"><backend model="random">/dev/urandom</backend></rng>
|
|
</devices>
|
|
</domain>
|