David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 1 | --- |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 2 | - name: Generate DPID |
| 3 | shell: ifconfig ma1 | grep HWaddr | awk '{ print "0x0000"$5 }' | sed s/://g |
| 4 | register: dpid |
| 5 | changed_when: false |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 6 | |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 7 | - name: Ensure ofdpa Config |
| 8 | set_fact: |
| 9 | switch_id: "{{ dpid.stdout }}" |
| 10 | controller_ip: "onos-fabric" |
| 11 | |
| 12 | - name: Verify Openflow Agent |
| 13 | shell: which ofdpa | wc -w |
| 14 | register: ofdpa_exists |
| 15 | changed_when: false |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 16 | |
| 17 | - name: Openflow Agent Version |
| 18 | shell: ofdpa --version |
| 19 | register: ofdpa_version |
| 20 | changed_when: false |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 21 | when: ofdpa_exists.stdout != "0" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 22 | |
| 23 | - name: Version I.12.1.1+1.1 Openflow Agent |
| 24 | include: ofdpa.yml |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 25 | when: ofdpa_exists.stdout == "0" or ofdpa_version.stdout.find('version I.12.1.1+1.1') == -1 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 26 | |
| 27 | - name: Utilities Scripts |
| 28 | template: |
| 29 | src: files/{{ item }} |
| 30 | dest: /root |
| 31 | owner: root |
| 32 | group: root |
| 33 | mode: 0755 |
| 34 | with_items: |
| 35 | - purge |
| 36 | - killit |
| 37 | - connect |
| 38 | - reset |
| 39 | register: utils |
| 40 | |
Charles Chan | 90c422a | 2016-08-01 16:33:07 -0700 | [diff] [blame] | 41 | - name: Mark Utilities Persistent |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 42 | command: persist {{ item }} |
| 43 | with_items: |
| 44 | - purge |
| 45 | - killit |
| 46 | - connect |
| 47 | - reset |
| 48 | when: utils.changed |
| 49 | |
Charles Chan | 90c422a | 2016-08-01 16:33:07 -0700 | [diff] [blame] | 50 | - name: Authorize SSH Key |
| 51 | become: yes |
| 52 | authorized_key: |
| 53 | key={{ pub_ssh_key }} |
| 54 | user=root |
| 55 | state=present |
| 56 | register: sshkey |
| 57 | |
| 58 | - name: Mark SSH Key Persistent |
| 59 | command: persist /root/.ssh/authorized_keys |
| 60 | when: sshkey.changed |
| 61 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 62 | - name: Persist |
| 63 | command: savepersist |
Charles Chan | 90c422a | 2016-08-01 16:33:07 -0700 | [diff] [blame] | 64 | when: utils.changed or sshkey.changed |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 65 | failed_when: false |