diff options
author | Fatih Degirmenci <fdegir@gmail.com> | 2018-06-20 23:56:03 +0200 |
---|---|---|
committer | Fatih Degirmenci <fdegir@gmail.com> | 2018-08-08 10:31:01 +0200 |
commit | a44164fde75c88ddbb5d2d9770aaeb8978c2c0fa (patch) | |
tree | 17c11152b264f765068446bccedce4a904a92211 /scenarios | |
parent | 47145857b78f8093aa0653a16158e2940deac697 (diff) |
Create os-nosdn-osm scenario
The tasks added by this change
- configure opnfv host by installing required OSM packages, configuring
lxd and lxd bridge, making devuser member of lxd and docker groups
- clone OSM devops repo and checks out specific version
- execute install_osm.sh script with certain arguments to ensure script
runs unattended
The installation of OSM is based on
https://osm.etsi.org/wikipub/index.php/OSM_Release_FOUR#Install_OSM_Release_FOUR
Change-Id: I8897288f7d0cadc4931ca21de13a4f4418fff7a8
Signed-off-by: Fatih Degirmenci <fdegir@gmail.com>
Diffstat (limited to 'scenarios')
7 files changed, 178 insertions, 0 deletions
diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/defaults/main.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/defaults/main.yml new file mode 100644 index 0000000..3e9829c --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/defaults/main.yml @@ -0,0 +1,22 @@ +--- +# 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 +############################################################################## +lxd_bridge: "lxdbr0" +lxd_domain: "lxd" +lxd_ipv4_addr: "10.0.8.1" +lxd_ipv4_netmask: "255.255.255.0" +lxd_ipv4_network: "10.0.8.1/24" +lxd_ipv4_dhcp_range: "10.0.8.2,10.0.8.254" +lxd_ipv4_dhcp_max: "250" +lxd_ipv4_nat: "true" +lxd_ipv6_addr: "" +lxd_ipv6_mask: "" +lxd_ipv6_network: "" +lxd_ipv6_nat: "false" +lxd_ipv6_proxy: "false" diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/configure-opnfvhost.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/configure-opnfvhost.yml new file mode 100644 index 0000000..d2630c4 --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/configure-opnfvhost.yml @@ -0,0 +1,72 @@ +# 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 +- 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 diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml new file mode 100644 index 0000000..30875e5 --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml @@ -0,0 +1,24 @@ +# 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: clone OSM devops repo and checkout version {{ osm_devops_version }} + become_user: "{{ osm_install_user }}" + become: yes + git: + repo: "{{ osm_devops_git_url }}" + dest: "{{ osm_devops_clone_location }}" + version: "{{ osm_devops_version }}" + +- name: install OSM + become_user: "{{ osm_install_user }}" + become: yes + command: "/bin/bash ./install_osm.sh -y --nolxd" + args: + chdir: "{{ osm_devops_clone_location }}/installers" + creates: "/usr/bin/osm" diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/main.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/main.yml new file mode 100644 index 0000000..d63c7f1 --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/main.yml @@ -0,0 +1,13 @@ +# 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 +############################################################################## + +# All the tasks for os-nosdn-osm scenario are executed post-deployment +# so we do not run anything here +- debug: + msg: "No pre-deployment task found for the scenario {{ deploy_scenario }}. Skipping." diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml new file mode 100644 index 0000000..0fb8014 --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml @@ -0,0 +1,11 @@ +# 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 +############################################################################## + +- include: configure-opnfvhost.yml +- include: install-osm.yml diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/templates/lxd-bridge.j2 b/scenarios/os-nosdn-osm/role/os-nosdn-osm/templates/lxd-bridge.j2 new file mode 100644 index 0000000..707cc46 --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/templates/lxd-bridge.j2 @@ -0,0 +1,16 @@ +USE_LXD_BRIDGE="true" +LXD_BRIDGE="{{ lxd_bridge }}" +UPDATE_PROFILE="true" +LXD_CONFILE="" +LXD_DOMAIN="{{ lxd_domain }}" +LXD_IPV4_ADDR="{{ lxd_ipv4_addr }}" +LXD_IPV4_NETMASK="{{ lxd_ipv4_netmask }}" +LXD_IPV4_NETWORK="{{ lxd_ipv4_network }}" +LXD_IPV4_DHCP_RANGE="{{ lxd_ipv4_dhcp_range }}" +LXD_IPV4_DHCP_MAX="{{ lxd_ipv4_dhcp_max }}" +LXD_IPV4_NAT="{{ lxd_ipv4_nat }}" +LXD_IPV6_ADDR="{{ lxd_ipv6_addr }}" +LXD_IPV6_MASK="{{ lxd_ipv6_mask }}" +LXD_IPV6_NETWORK="{{ lxd_ipv6_network }}" +LXD_IPV6_NAT="{{ lxd_ipv6_nat }}" +LXD_IPV6_PROXY="{{ lxd_ipv6_proxy }}" diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml new file mode 100644 index 0000000..6b38c1f --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml @@ -0,0 +1,20 @@ +--- +# 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 +############################################################################## +osm_required_packages: + apt: + - apt-transport-https + - ca-certificates + - software-properties-common + - docker.io + - snapd + - lxd + +osm_install_user: "devuser" +osm_devops_clone_location: "/home/{{ osm_install_user }}/osm-devops" |