blob: 41251e7b0d24b47b2b3d904333c533689e9d58cb [file] [log] [blame]
David K. Bainbridge317e7d72016-05-11 08:31:44 -07001---
David K. Bainbridgef4181702016-06-17 14:44:03 -07002- 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. Bainbridge317e7d72016-05-11 08:31:44 -07006
David K. Bainbridgef4181702016-06-17 14:44:03 -07007- 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. Bainbridge317e7d72016-05-11 08:31:44 -070016
17- name: Openflow Agent Version
18 shell: ofdpa --version
19 register: ofdpa_version
20 changed_when: false
David K. Bainbridgef4181702016-06-17 14:44:03 -070021 when: ofdpa_exists.stdout != "0"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070022
23- name: Version I.12.1.1+1.1 Openflow Agent
24 include: ofdpa.yml
David K. Bainbridgef4181702016-06-17 14:44:03 -070025 when: ofdpa_exists.stdout == "0" or ofdpa_version.stdout.find('version I.12.1.1+1.1') == -1
David K. Bainbridge317e7d72016-05-11 08:31:44 -070026
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 Chanaba1b562016-08-01 16:33:07 -070041- name: Mark Utilities Persistent
David K. Bainbridge317e7d72016-05-11 08:31:44 -070042 command: persist {{ item }}
43 with_items:
44 - purge
45 - killit
46 - connect
47 - reset
48 when: utils.changed
49
Charles Chanaba1b562016-08-01 16:33:07 -070050- 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. Bainbridge317e7d72016-05-11 08:31:44 -070062- name: Persist
63 command: savepersist
Charles Chanaba1b562016-08-01 16:33:07 -070064 when: utils.changed or sshkey.changed
David K. Bainbridge317e7d72016-05-11 08:31:44 -070065 failed_when: false