blob: 818828ce20f831a6c58b35173100192163cd1192 [file] [log] [blame]
Jonathan Hart93956f52017-08-22 13:12:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
David K. Bainbridge317e7d72016-05-11 08:31:44 -070016---
David K. Bainbridgef4181702016-06-17 14:44:03 -070017- name: Generate DPID
Luca Prete57e76272017-12-11 14:15:08 -080018 shell: ifconfig | grep HWaddr | head -1 | awk '{ print "0x0000"$5 }' | sed s/://g
David K. Bainbridgef4181702016-06-17 14:44:03 -070019 register: dpid
20 changed_when: false
David K. Bainbridge317e7d72016-05-11 08:31:44 -070021
Luca Prete57e76272017-12-11 14:15:08 -080022- name: Get switch OUI
23 shell: ifconfig | grep HWaddr | head -1 | awk '{ print $5 }' | sed s/://g | cut -c1-6
24 register: oui
25 changed_when: false
26
27- name: Ensure OFDPA Config
David K. Bainbridgef4181702016-06-17 14:44:03 -070028 set_fact:
29 switch_id: "{{ dpid.stdout }}"
30 controller_ip: "onos-fabric"
31
32- name: Verify Openflow Agent
Jonathan Hart1728fc82017-08-22 12:47:10 -070033 shell: which ofagentapp | wc -w
David K. Bainbridgef4181702016-06-17 14:44:03 -070034 register: ofdpa_exists
35 changed_when: false
David K. Bainbridge317e7d72016-05-11 08:31:44 -070036
37- name: Openflow Agent Version
Jonathan Hart1728fc82017-08-22 12:47:10 -070038 command: ofagentapp --version
David K. Bainbridge317e7d72016-05-11 08:31:44 -070039 register: ofdpa_version
40 changed_when: false
David K. Bainbridgef4181702016-06-17 14:44:03 -070041 when: ofdpa_exists.stdout != "0"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070042
Luca Prete57e76272017-12-11 14:15:08 -080043- name: Install OFDPA commons steps
David K. Bainbridge317e7d72016-05-11 08:31:44 -070044 include: ofdpa.yml
Luca Prete57e76272017-12-11 14:15:08 -080045 when: ofdpa_exists.stdout == "0" or
46 (ofdpa_version.stdout.find('3.0.4.0') == -1 and ofdpa_version.stdout.find('3.0.5.0') == -1)
David K. Bainbridge317e7d72016-05-11 08:31:44 -070047
Luca Prete57e76272017-12-11 14:15:08 -080048- name: Install OFDPA for Accton switches
49 include: ofdpa-accton.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}"
Luca Prete57e76272017-12-11 14:15:08 -080050 when:
51 - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.4.0') == -1
52 # Accton related OUIs
Luca Pretec0eefef2017-12-19 11:00:06 -080053 - oui.stdout in switch_ouis['accton']
Luca Prete57e76272017-12-11 14:15:08 -080054
55- name: Install OFDPA for QCT switches
56 include: ofdpa-qct.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}"
Luca Prete57e76272017-12-11 14:15:08 -080057 when:
58 - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.5.0') == -1
Luca Pretec0eefef2017-12-19 11:00:06 -080059 # QCT related OUIs
60 - oui.stdout in switch_ouis['qct']
David K. Bainbridge317e7d72016-05-11 08:31:44 -070061
Charles Chanaba1b562016-08-01 16:33:07 -070062- name: Authorize SSH Key
63 become: yes
64 authorized_key:
65 key={{ pub_ssh_key }}
66 user=root
67 state=present
68 register: sshkey