| --- |
| - name: Generate DPID |
| shell: ifconfig ma1 | grep HWaddr | awk '{ print "0x0000"$5 }' | sed s/://g |
| register: dpid |
| changed_when: false |
| |
| - name: Ensure ofdpa Config |
| set_fact: |
| switch_id: "{{ dpid.stdout }}" |
| controller_ip: "onos-fabric" |
| |
| - name: Verify Openflow Agent |
| shell: which ofdpa | wc -w |
| register: ofdpa_exists |
| changed_when: false |
| |
| - name: Openflow Agent Version |
| command: ofdpa --version |
| register: ofdpa_version |
| changed_when: false |
| when: ofdpa_exists.stdout != "0" |
| |
| - name: Version I.12.1.1+1.1 Openflow Agent |
| include: ofdpa.yml |
| when: ofdpa_exists.stdout == "0" or ofdpa_version.stdout.find('version I.12.1.1+1.1') == -1 |
| |
| - name: Utilities Scripts |
| template: |
| src: "{{ item }}" |
| dest: /root |
| owner: root |
| group: root |
| mode: 0755 |
| with_items: |
| - purge |
| - killit |
| - connect |
| - reset |
| register: utils |
| |
| - name: Mark Utilities Persistent |
| command: persist {{ item }} |
| with_items: |
| - purge |
| - killit |
| - connect |
| - reset |
| when: utils.changed |
| |
| - name: Authorize SSH Key |
| become: yes |
| authorized_key: |
| key={{ pub_ssh_key }} |
| user=root |
| state=present |
| register: sshkey |
| |
| - name: Mark SSH Key Persistent |
| command: persist /root/.ssh/authorized_keys |
| when: sshkey.changed |
| |
| - name: Persist |
| command: savepersist |
| when: utils.changed or sshkey.changed |
| failed_when: false |