Jonathan Hart | 93956f5 | 2017-08-22 13:12:42 -0700 | [diff] [blame] | 1 | |
| 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 | |
| 16 | |
Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 17 | --- |
| 18 | - name: Locate all switches |
| 19 | hosts: localhost |
| 20 | tasks: |
| 21 | - name: Lookup DHCP harvest |
Charles Chan | 86616c9 | 2016-09-13 13:05:57 -0700 | [diff] [blame] | 22 | shell: cat /etc/bind/maas/dhcp_harvest.inc | grep -i " cc:37:ab\| 70:72:cf" | awk '{print $1}' |
Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 23 | register: switches |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 24 | changed_when: false |
Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 25 | - name: Add hosts into inventory |
| 26 | add_host: name={{item}} group=fabric |
| 27 | with_items: "{{switches.stdout_lines}}" |
| 28 | |
| 29 | - name: Connect all fabric switches to onos-fabric |
| 30 | hosts: fabric |
| 31 | remote_user: root |
| 32 | tasks: |
| 33 | - name: Check the status of indigo agent |
| 34 | command: ps aux |
| 35 | changed_when: false |
| 36 | register: status |
| 37 | |
| 38 | - name: Terminate indigo agent |
| 39 | command: /root/killit |
| 40 | when: status.stdout.find('brcm-indigo-ofdpa-ofagent') != -1 |
| 41 | |
| 42 | - name: Purge hardware tables |
| 43 | command: /root/purge |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 44 | changed_when: true |
Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 45 | |
| 46 | - name: Start indigo agent |
| 47 | command: /root/connect -bg |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 48 | changed_when: true |
Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 49 | |
| 50 | - name: Verify indigo agent has been started |
| 51 | command: ps aux |
| 52 | changed_when: false |
| 53 | register: status |
| 54 | failed_when: status.stdout.find('brcm-indigo-ofdpa-ofagent') == -1 |