Merge "Update user variables to match common-packer"
authorSam Hague <shague@redhat.com>
Wed, 10 Jan 2018 16:55:25 +0000 (16:55 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Jan 2018 16:55:25 +0000 (16:55 +0000)
packer/provision/builder.yaml
packer/provision/mininet-ovs-2.8.yaml [new file with mode: 0644]
packer/templates/mininet-ovs-2.8.json [new file with mode: 0644]

index 03776b5eceebb007a047d3a219432964c0507901..459c4a5342d95a3fd63215a4ffe2c3c25c5a82e6 100644 (file)
@@ -49,6 +49,7 @@
           shell: /tmp/build_quagga/zrpcd/pkgsrc/dev_compile_script.sh -d -b -t
           args:
             chdir: /tmp/build_quagga/zrpcd
+            executable: /bin/bash
           become: true
 
   post_tasks:
diff --git a/packer/provision/mininet-ovs-2.8.yaml b/packer/provision/mininet-ovs-2.8.yaml
new file mode 100644 (file)
index 0000000..e85baf2
--- /dev/null
@@ -0,0 +1,156 @@
+---
+- import_playbook: ../common-packer/provision/baseline.yaml
+
+- hosts: all
+  become_user: root
+  become_method: sudo
+  vars:
+    ovs_checksum: sha256:8d1c439e26d7044f0ec823c7fef1b00b7c6465da0b83a7d0cf3191ed1dc43893
+    ovs_version: 2.8.1
+
+  pre_tasks:
+    - include_role: name=system-update
+
+  tasks:
+    - name: 'Install OpenVSwitch {{ovs_version}}'
+      block:
+        - name: Install OpenVSwitch dependencies
+          apt: 'name={{item}} state=present'
+          with_items:
+            - autoconf
+            - automake
+            - bzip2
+            - debhelper
+            - dh-autoreconf
+            - libssl-dev
+            - openssl
+            - pkg-config
+            - procps
+            - python-all
+            - python-qt4
+            - python-twisted-conch
+            - python-zopeinterface
+          become: true
+        - name: 'Fetch OpenVSwitch {{ovs_version}}'
+          get_url:
+            url: 'http://openvswitch.org/releases/openvswitch-{{ovs_version}}.tar.gz'
+            dest: '/tmp/openvswitch-{{ovs_version}}.tar.gz'
+            checksum: '{{ovs_checksum}}'
+        - name: Create /tmp/ovs directory
+          file:
+            path: /tmp/ovs
+            state: directory
+            mode: 0755
+        - name: 'Unarchive OpenVSwitch {{ovs_version}}'
+          unarchive:
+            src: '/tmp/openvswitch-{{ovs_version}}.tar.gz'
+            dest: /tmp/ovs
+            remote_src: true
+        - name: 'Build OpenVSwitch {{ovs_version}}'
+          shell: DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
+          args:
+            chdir: '/tmp/ovs/openvswitch-{{ovs_version}}'
+        - name: 'Install OpenVSwitch {{ovs_version}}'
+          apt: 'deb={{item}}'
+          with_items:
+            - /tmp/ovs/libopenvswitch_2.8.1-1_amd64.deb
+            - /tmp/ovs/openvswitch-common_2.8.1-1_amd64.deb
+            - /tmp/ovs/openvswitch-switch_2.8.1-1_amd64.deb
+            - /tmp/ovs/python-openvswitch_2.8.1-1_all.deb
+            - /tmp/ovs/openvswitch-vtep_2.8.1-1_amd64.deb
+          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 mtcbench
+      block:
+        - name: Install mtcbench dependencies
+          apt: 'name={{item}} state=present'
+          with_items:
+            - autoconf
+            - automake
+            - build-essential
+            - libconfig-dev
+            - libffi-dev
+            - libpcap-dev
+            - libsnmp-dev
+            - libtool
+            - libssl-doc
+            - make
+            - pkg-config
+            - snmp
+            - snmpd
+          become: true
+        - name: Fetch mtcbench git repo
+          git:
+            repo: https://github.com/intracom-telecom-sdn/mtcbench.git
+            dest: /tmp/mtcbench
+        - name: Run mtcbench/deploy/docker/provision.sh
+          command: /tmp/mtcbench/deploy/docker/provision.sh
+          become: true
+        - name: Build mtcbench
+          # TODO: remove workaround for build issue with mtcbench
+          # when mtcbench dependency build correctly
+          # https://github.com/intracom-telecom-sdn/mtcbench/issues/10
+          shell: /tmp/mtcbench/build_mtcbench.sh || true
+        - name: Run make for cbench
+          command: make
+          args:
+            chdir: /tmp/mtcbench/oflops/cbench
+        - name: Install cbench to /usr/local/bin/cbench
+          copy:
+            src: /tmp/mtcbench/oflops/cbench/cbench
+            dest: /usr/local/bin/cbench
+            mode: 0755
+            owner: root
+            remote_src: yes
+          become: true
+
+    - name: Install exabgp
+      apt: name=exabgp state=present
+      become: true
+
+    - name: Install python-netaddr for custom mininet topologies
+      apt: name=python-netaddr state=present
+      become: true
+
+    - name: Install vlan for vlan based tests in VTN suites
+      apt: name=vlan state=present
+      become: true
+
+    - name: Install Quagga
+      block:
+        - name: Fetch Quagga git repo
+          git:
+            repo: https://github.com/6WIND/zrpcd.git
+            dest: /tmp/build_quagga/zrpcd
+            version: 20170731
+        - name: Set compile script executable
+          file:
+            path: /tmp/build_quagga/zrpcd/pkgsrc/dev_compile_script.sh
+            mode: 0755
+        - name: Compile Quagga
+          shell: /tmp/build_quagga/zrpcd/pkgsrc/dev_compile_script.sh -d -b -t
+          args:
+            chdir: /tmp/build_quagga/zrpcd
+            executable: /bin/bash
+          become: true
+
+  post_tasks:
+    - name: System Reseal
+      script: ../common-packer/provision/system-reseal.sh
+      become: true
diff --git a/packer/templates/mininet-ovs-2.8.json b/packer/templates/mininet-ovs-2.8.json
new file mode 100644 (file)
index 0000000..142d492
--- /dev/null
@@ -0,0 +1,59 @@
+{
+  "variables": {
+    "base_image": null,
+    "distro": null,
+    "cloud_auth_url": null,
+    "cloud_user": null,
+    "cloud_pass": null,
+    "cloud_network": null,
+    "cloud_tenant": null,
+    "cloud_user_data": null,
+    "ssh_user": null,
+    "ssh_proxy_host": ""
+  },
+  "builders": [
+    {
+      "name": "vexxhost",
+      "image_name": "ZZCI - {{user `distro`}} - mininet-ovs-28 - {{isotime \"20060102-1504\"}}",
+      "source_image_name": "{{user `base_image`}}",
+      "type": "openstack",
+      "identity_endpoint": "{{user `cloud_auth_url`}}",
+      "username": "{{user `cloud_user`}}",
+      "password": "{{user `cloud_pass`}}",
+      "tenant_name": "{{user `cloud_tenant`}}",
+      "domain_name": "Default",
+      "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"
+      }
+    }
+  ],
+  "provisioners": [
+    {
+      "type": "shell",
+      "scripts": [
+        "common-packer/provision/install-python.sh"
+      ],
+      "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+    },
+    {
+      "type": "ansible",
+      "playbook_file": "provision/mininet-ovs-2.8.yaml",
+      "ansible_env_vars": [
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=True",
+        "ANSIBLE_ROLES_PATH=../lf-ansible/roles",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
+      ]
+    }
+  ]
+}