Charles Chan | a4ccbde | 2016-08-02 00:12:34 -0700 | [diff] [blame] | 1 | --- |
| 2 | - name: Locate all switches |
| 3 | hosts: localhost |
| 4 | tasks: |
| 5 | - name: Lookup DHCP harvest |
| 6 | shell: cat /etc/bind/maas/dhcp_harvest.inc | grep -i " cc:37:ab\| 70:72;cf" | awk '{print $1}' |
| 7 | register: switches |
| 8 | - name: Add hosts into inventory |
| 9 | add_host: name={{item}} group=fabric |
| 10 | with_items: "{{switches.stdout_lines}}" |
| 11 | |
| 12 | - name: Connect all fabric switches to onos-fabric |
| 13 | hosts: fabric |
| 14 | remote_user: root |
| 15 | tasks: |
| 16 | - name: Check the status of indigo agent |
| 17 | command: ps aux |
| 18 | changed_when: false |
| 19 | register: status |
| 20 | |
| 21 | - name: Terminate indigo agent |
| 22 | command: /root/killit |
| 23 | when: status.stdout.find('brcm-indigo-ofdpa-ofagent') != -1 |
| 24 | |
| 25 | - name: Purge hardware tables |
| 26 | command: /root/purge |
| 27 | |
| 28 | - name: Start indigo agent |
| 29 | command: /root/connect -bg |
| 30 | |
| 31 | - name: Verify indigo agent has been started |
| 32 | command: ps aux |
| 33 | changed_when: false |
| 34 | register: status |
| 35 | failed_when: status.stdout.find('brcm-indigo-ofdpa-ofagent') == -1 |