From: Venkatrangan Govindarajan Date: Mon, 15 Apr 2019 09:05:00 +0000 (+0000) Subject: Merge "Provision mininet-ovs-25 image with Ansible" X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=12642399104ef4d3cb9e0bda0cfacc322f0e82d7;hp=687df454b118b923bddf589c149b996bdeab48f8;p=releng%2Fbuilder.git Merge "Provision mininet-ovs-25 image with Ansible" --- diff --git a/packer/provision/mininet-ovs-2.5.sh b/packer/provision/mininet-ovs-2.5.sh deleted file mode 100644 index 7cbab296a..000000000 --- a/packer/provision/mininet-ovs-2.5.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -x - -# vim: sw=4 ts=4 sts=4 et tw=72 : - -# force any errors to cause the script and job to end in failure -set -xeu -o pipefail - -# Ensure that necessary variables are set to enable noninteractive mode in -# commands. -export DEBIAN_FRONTEND=noninteractive - -# To handle the prompt style that is expected all over the environment -# with how use use robotframework we need to make sure that it is -# consistent for any of the users that are created during dynamic spin -# ups -echo 'PS1="[\u@\h \W]> "' >> /etc/skel/.bashrc - -echo '---> Install OpenVSwitch 2.5.0' -apt-get update -m -apt-get install openvswitch-switch openvswitch-vtep - -# Temporary workaround required to bring up OVS -# post-install without which OVS daemon exits. -service openvswitch-switch restart -# Verify the OVS service status -service openvswitch-switch status - -echo '---> Installing mininet' -apt-get install mininet - -echo '---> Installing build pre-requisites' -apt-get install build-essential snmp libsnmp-dev snmpd libpcap-dev \ -autoconf make automake libtool libconfig-dev libssl-dev libffi-dev libssl-doc pkg-config - -git clone https://github.com/intracom-telecom-sdn/mtcbench.git -mtcbench/deploy/docker/provision.sh -# TODO: remove workaround for build issue with mtcbench -# when mtcbench dependency build correctly -# https://github.com/intracom-telecom-sdn/mtcbench/issues/10 -mtcbench/build_mtcbench.sh || true -cd mtcbench/oflops/cbench -make -cp cbench /usr/local/bin/ - -echo '---> Installing exabgp' -apt-get install exabgp - -# Install vlan for vlan based tests in VTN suites -apt-get install vlan - -# Install netaddr package which is needed by some custom mininet topologies -apt-get install python-netaddr diff --git a/packer/provision/mininet-ovs-2.5.yaml b/packer/provision/mininet-ovs-2.5.yaml new file mode 100644 index 000000000..9de3df359 --- /dev/null +++ b/packer/provision/mininet-ovs-2.5.yaml @@ -0,0 +1,69 @@ +--- +- import_playbook: ../common-packer/provision/baseline.yaml + +- hosts: all + become_user: root + become_method: sudo + + pre_tasks: + - include_role: name=lfit.system-update + + tasks: + - name: 'Install OpenVSwitch {{ovs_version}}' + block: + - name: 'Install dependencies required for OpenVSwitch {{ovs_version}}' + apt: 'name={{item}} state=present' + with_items: + - dh-autoreconf + - debhelper + - autoconf + - automake + - libssl-dev + - pkg-config + - bzip2 + - openssl + - python-all + - procps + - python-qt4 + - python-zopeinterface + - python-twisted-conch + become: true + - name: 'Install OpenVSwitch {{ovs_version}}' + apt: 'name={{item}} state=present' + with_items: + - openvswitch-switch + - openvswitch-vtep + become: true + - name: Enable openvswitch-switch service + systemd: + name: openvswitch-switch + enabled: true + masked: false + become: true + - name: Enable openvswitch-vtep service + systemd: + name: openvswitch-vtep + enabled: true + masked: false + become: true + + - name: Install Mininet + apt: name=mininet state=present + become: true + + - name: Install exabgp + apt: name=exabgp state=present + become: true + + - name: Install vlan for vlan based tests in VTN suites + apt: name=vlan state=present + become: true + + - name: Install python-netaddr for custom mininet topologies + apt: name=python-netaddr state=present + become: true + + post_tasks: + - name: System Reseal + script: ../common-packer/provision/system-reseal.sh + become: true diff --git a/packer/templates/mininet-ovs-2.5.json b/packer/templates/mininet-ovs-2.5.json index 70a81d530..df2372f14 100644 --- a/packer/templates/mininet-ovs-2.5.json +++ b/packer/templates/mininet-ovs-2.5.json @@ -1,5 +1,6 @@ { "variables": { + "ansible_roles_path": ".galaxy", "base_image": null, "distro": null, "cloud_network": null, @@ -9,19 +10,20 @@ }, "builders": [ { - "type": "openstack", - "region": "ca-ymq-1", - "availability_zone": "ca-ymq-2", - "ssh_username": "{{user `ssh_user`}}", - "ssh_proxy_host": "{{user `ssh_proxy_host`}}", + "name": "vexxhost", "image_name": "ZZCI - {{user `distro`}} - mininet-ovs-25 - {{isotime \"20060102-150405.000\"}}", "instance_name": "{{user `distro`}}-mininet-ovs-25-{{uuid}}", "source_image_name": "{{user `base_image`}}", - "flavor": "v1-standard-1", + "type": "openstack", + "region": "ca-ymq-1", + "availability_zone": "ca-ymq-2", "networks": [ "{{user `cloud_network`}}" ], "user_data_file": "{{user `cloud_user_data`}}", + "ssh_username": "{{user `ssh_user`}}", + "ssh_proxy_host": "{{user `ssh_proxy_host`}}", + "flavor": "v1-standard-1", "metadata": { "ci_managed": "yes" } @@ -31,12 +33,24 @@ { "type": "shell", "scripts": [ - "provision/baseline.sh", - "provision/mininet-ovs-2.5.sh", - "provision/system_reseal_local_env.sh", - "provision/system_reseal.sh" + "common-packer/provision/install-python.sh" ], "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi" + }, + { + "type": "shell-local", + "command": "./common-packer/ansible-galaxy.sh {{user `ansible_roles_path`}}" + }, + { + "type": "ansible", + "playbook_file": "provision/mininet-ovs-2.5.yaml", + "ansible_env_vars": [ + "ANSIBLE_NOCOWS=1", + "ANSIBLE_PIPELINING=True", + "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}", + "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", + "ANSIBLE_STDOUT_CALLBACK=debug" + ] } ] }