blob: 8edba81d1a6b2ebd273cb1c8b99d2c25b2c5cb92 [file] [log] [blame]
Fatih Degirmenci50b146b2019-05-10 14:11:57 +02001---
2# ============LICENSE_START=======================================================
3# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
Fatih Degirmencief0b16f2020-01-08 23:53:05 +000019
Fatih Degirmenci50b146b2019-05-10 14:11:57 +020020- name: "Load distribution defaults"
21 include_vars: "{{ ansible_os_family | lower }}.yml"
22
Fatih Degirmenci50b146b2019-05-10 14:11:57 +020023- name: "Restart libvirt service"
24 service:
25 name: "{{ libvirt_service_name }}"
26 state: restarted
27
28# NOTE(Shrews) We need to enable ip forwarding for the libvirt bridge to
29# operate properly with dnsmasq. This should be done before starting dnsmasq.
30- name: "Enable IP forwarding in sysctl"
31 sysctl:
32 name: "net.ipv4.ip_forward"
33 value: 1
34 sysctl_set: yes
35 state: present
36 reload: yes
37
38# NOTE(Shrews) Ubuntu packaging+apparmor issue prevents libvirt from loading
39# the ROM from /usr/share/misc.
40- name: "Look for sgabios in {{ sgabios_dir }}"
41 stat: path={{ sgabios_dir }}/sgabios.bin
42 register: test_sgabios_qemu
43
44- name: "Look for sgabios in /usr/share/misc"
45 stat: path=/usr/share/misc/sgabios.bin
46 register: test_sgabios_misc
47
48- name: "Place sgabios.bin"
49 command: cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
Fatih Degirmencidf251d52019-12-11 13:43:10 +010050 when:
51 - not test_sgabios_qemu
52 - test_sgabios_misc
Fatih Degirmenci50b146b2019-05-10 14:11:57 +020053
54# NOTE(TheJulia): In order to prevent conflicts, stop
55# dnsmasq to prevent conflicts with libvirt restarting.
56# TODO(TheJulia): We shouldn't need to do this, but the
57# libvirt dhcp instance conflicts withour specific config
58# and taking this path allows us to not refactor dhcp at
59# this moment. Our DHCP serving should be refactored
60# so we don't need to do this.
61- name: "Stop default dnsmasq service"
62 service:
63 name: dnsmasq
64 state: stopped
65 ignore_errors: true
66
67# Ubuntu creates a default network when installing libvirt.
68# This network uses the 192.168.122.0/24 range and thus
69# conflicts with our admin network
70- name: Destroy default libvirt network
71 virt_net:
72 name: "default"
73 state: absent
74 uri: "{{ vm_libvirt_uri }}"
75
76# vim: set ts=2 sw=2 expandtab: