aboutsummaryrefslogtreecommitdiffstats
path: root/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/configure-opnfvhost.yml
blob: 3a0226b0089c630fa8e0c8057423b4a1d9f9741e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2018 Ericsson AB and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

- name: install OSM required packages
  package:
    name: "{{ osm_required_packages[ansible_pkg_mgr] }}"
    state: present

- name: initialize LXD
  command: "{{ item }}"
  with_items:
    - lxd init --auto
    - lxd waitready
  changed_when: False
- name: stop lxd-bridge service
  systemd:
    name: lxd-bridge
    state: stopped
    daemon_reload: yes
- name: create lxd-bridge configuration
  template:
    src: lxd-bridge.j2
    dest: /etc/default/lxd-bridge
    mode: 0755

- name: ensure dnsmasq service is stopped before attempting to start lxd-bridge
  service:
    name: dnsmasq
    state: stopped

- name: ensure dnsmasq uses interface br-vlan for lxd-bridge
  lineinfile:
    path: /etc/dnsmasq.conf
    regexp: '^interface='
    line: 'interface=br-vlan'

- name: ensure docker and lxd-bridge services are started and enabled
  service:
    name: "{{ item }}"
    state: started
    enabled: yes
  with_items:
    - docker
    - lxd-bridge

- name: get default interface
  shell: route -n | awk '$1~/^0.0.0.0/ {print $8}'
  register: default_interface
  ignore_errors: False
  changed_when: False

- name: get mtu of the default interface {{ default_interface.stdout }}
  shell: ip addr show {{ default_interface.stdout }} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}'
  register: default_interface_mtu
  ignore_errors: False
  changed_when: False

- name: set lxdbr0 mtu to {{ default_interface_mtu.stdout }}
  command: ifconfig lxdbr0 mtu {{ default_interface_mtu.stdout }}
  ignore_errors: False
  changed_when: False

- name: add devuser to lxd and docker groups
  user:
    name: devuser
    groups: lxd, docker
    append: yes