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
77 lines
2.7 KiB
YAML
77 lines
2.7 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.
|
|
|
|
---
|
|
- name: Detect the virtualisation engine
|
|
block:
|
|
- name: Load the kvm kernel module
|
|
modprobe:
|
|
name: kvm
|
|
become: true
|
|
failed_when: false
|
|
|
|
- name: Check for the KVM device
|
|
stat:
|
|
path: /dev/kvm
|
|
register: stat_kvm
|
|
|
|
- name: Set a fact containing the virtualisation engine
|
|
set_fact:
|
|
libvirt_vm_engine: >-
|
|
{%- if ansible_architecture != libvirt_vm_arch -%}
|
|
{# Virtualisation instructions are generally available only for the host
|
|
architecture. Ideally we would test for virtualisation instructions, eg. vt-d
|
|
as it is possible that another architecture could support these even
|
|
if the emulated cpu architecture is not the same. #}
|
|
qemu
|
|
{%- elif stat_kvm.stat.exists -%}
|
|
kvm
|
|
{%- else -%}
|
|
qemu
|
|
{%- endif -%}
|
|
when: libvirt_vm_engine is none or libvirt_vm_engine | length == 0
|
|
|
|
- name: Detect the virtualisation emulator
|
|
block:
|
|
- block:
|
|
- name: Detect the KVM emulator binary path
|
|
stat:
|
|
path: "{{ item }}"
|
|
register: kvm_emulator_result
|
|
with_items:
|
|
- /usr/bin/kvm
|
|
- /usr/bin/qemu-kvm
|
|
- /usr/libexec/qemu-kvm
|
|
|
|
- name: Set a fact containing the KVM emulator binary path
|
|
set_fact:
|
|
libvirt_vm_emulator: "{{ item.item }}"
|
|
with_items: "{{ kvm_emulator_result.results }}"
|
|
when: item.stat.exists
|
|
when: libvirt_vm_engine == 'kvm'
|
|
|
|
- block:
|
|
- name: Detect the QEMU emulator binary path
|
|
shell: which qemu-system-{{ libvirt_vm_arch }}
|
|
register: qemu_emulator_result
|
|
changed_when: false
|
|
|
|
- name: Set a fact containing the QEMU emulator binary path
|
|
set_fact:
|
|
libvirt_vm_emulator: "{{ qemu_emulator_result.stdout }}"
|
|
when: libvirt_vm_engine == 'qemu'
|
|
|
|
- name: Fail if unable to detect the emulator
|
|
fail:
|
|
msg: Unable to detect emulator for engine {{ libvirt_vm_engine }}.
|
|
when: libvirt_vm_emulator is none
|
|
when: libvirt_vm_emulator is none or libvirt_vm_emulator | length == 0 |