192da488b13f9aca331906592b3b1ef0c20bb175
[releng/builder.git] / packer / provision / mininet-ovs-2.8.yaml
1 ---
2 - import_playbook: ../common-packer/provision/baseline.yaml
3
4 - hosts: all
5   become_user: root
6   become_method: sudo
7   vars:
8     ovs_checksum: sha256:8d1c439e26d7044f0ec823c7fef1b00b7c6465da0b83a7d0cf3191ed1dc43893
9     ovs_version: 2.8.1
10
11   pre_tasks:
12     - include_role: name=lfit.system-update
13
14   tasks:
15     - name: "Install OpenVSwitch {{ovs_version}}"
16       block:
17         - name: Install OpenVSwitch dependencies
18           apt:
19             name:
20               - autoconf
21               - automake
22               - bzip2
23               - debhelper
24               - dh-autoreconf
25               - libssl-dev
26               - openssl
27               - pkg-config
28               - procps
29               - python-all
30               - python-qt4
31               - python-twisted-conch
32               - python-zopeinterface
33             state: present
34           become: true
35         - name: "Fetch OpenVSwitch {{ovs_version}}"
36           get_url:
37             url: "http://openvswitch.org/releases/openvswitch-{{ovs_version}}.tar.gz"
38             dest: "/tmp/openvswitch-{{ovs_version}}.tar.gz"
39             checksum: "{{ovs_checksum}}"
40         - name: Create /tmp/ovs directory
41           file:
42             path: /tmp/ovs
43             state: directory
44             mode: 0755
45         - name: "Unarchive OpenVSwitch {{ovs_version}}"
46           unarchive:
47             src: "/tmp/openvswitch-{{ovs_version}}.tar.gz"
48             dest: /tmp/ovs
49             remote_src: true
50         - name: "Build OpenVSwitch {{ovs_version}}"
51           shell: DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
52           args:
53             chdir: "/tmp/ovs/openvswitch-{{ovs_version}}"
54         - name: "Install OpenVSwitch {{ovs_version}}"
55           apt: "deb={{item}}"
56           with_items:
57             - /tmp/ovs/libopenvswitch_2.8.1-1_amd64.deb
58             - /tmp/ovs/openvswitch-common_2.8.1-1_amd64.deb
59             - /tmp/ovs/openvswitch-switch_2.8.1-1_amd64.deb
60             - /tmp/ovs/python-openvswitch_2.8.1-1_all.deb
61             - /tmp/ovs/openvswitch-vtep_2.8.1-1_amd64.deb
62           become: true
63         - name: Enable openvswitch-switch service
64           systemd:
65             name: openvswitch-switch
66             enabled: true
67             masked: false
68           become: true
69         - name: Enable openvswitch-vtep service
70           systemd:
71             name: openvswitch-vtep
72             enabled: true
73             masked: false
74           become: true
75
76     - name: Install Mininet
77       apt: name=mininet state=present
78       become: true
79
80     - name: Install mtcbench
81       block:
82         - name: Install mtcbench dependencies
83           apt:
84             name:
85               - autoconf
86               - automake
87               - build-essential
88               - libconfig-dev
89               - libffi-dev
90               - libpcap-dev
91               - libsnmp-dev
92               - libtool
93               - libssl-doc
94               - make
95               - pkg-config
96               - snmp
97               - snmpd
98             state: present
99           become: true
100         - name: Fetch mtcbench git repo
101           git:
102             repo: https://github.com/intracom-telecom-sdn/mtcbench.git
103             dest: /tmp/mtcbench
104         - name: Run mtcbench/deploy/docker/provision.sh
105           command: /tmp/mtcbench/deploy/docker/provision.sh
106           become: true
107         - name: Build mtcbench
108           # TODO: remove workaround for build issue with mtcbench
109           # when mtcbench dependency build correctly
110           # https://github.com/intracom-telecom-sdn/mtcbench/issues/10
111           shell: /tmp/mtcbench/build_mtcbench.sh || true
112         - name: Run make for cbench
113           command: make
114           args:
115             chdir: /tmp/mtcbench/oflops/cbench
116         - name: Install cbench to /usr/local/bin/cbench
117           copy:
118             src: /tmp/mtcbench/oflops/cbench/cbench
119             dest: /usr/local/bin/cbench
120             mode: 0755
121             owner: root
122             remote_src: true
123           become: true
124
125     - name: Install exabgp
126       apt: name=exabgp state=present
127       become: true
128
129     - name: Install python-netaddr for custom mininet topologies
130       apt: name=python-netaddr state=present
131       become: true
132
133     - name: Install vlan for vlan based tests in VTN suites
134       apt: name=vlan state=present
135       become: true
136
137     # This image is being used as a CSIT tools image and some of our
138     # CSIT test scripts are relying on python-2 and its request library.
139     # This makes sure we install them onto the image even though they
140     # are not required for the OVS rule of it.
141     - name: Install CSIT dependencies
142       apt:
143         name:
144           - python-requests
145         state: present
146       become: true
147
148   post_tasks:
149     - name: System Reseal
150       script: ../common-packer/provision/system-reseal.sh
151       become: true