Andy Bavier | b36b84e | 2017-08-10 14:46:32 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | - name: Remove old OVS |
| 16 | apt: |
| 17 | name: "{{ item }}" |
| 18 | state: absent |
| 19 | with_items: |
| 20 | - openvswitch-switch |
| 21 | - openvswitch-common |
| 22 | when: enable_fabric |
| 23 | |
| 24 | - name: Install default OVS |
| 25 | apt: |
| 26 | name: "{{ item }}" |
| 27 | state: present |
| 28 | with_items: "{{ ovs_packages }}" |
| 29 | when: not enable_fabric |
| 30 | |
| 31 | - name: (fabric) Download OVS 2.5.3 packages |
| 32 | get_url: |
| 33 | url: "{{ item.url }}" |
| 34 | checksum: "{{ item.checksum }}" |
| 35 | dest: "/tmp/{{ item.name }}" |
| 36 | with_items: "{{ ovs_fabric_packages }}" |
| 37 | when: enable_fabric |
| 38 | |
| 39 | - name: (fabric) Install OVS 2.5.3 |
| 40 | apt: |
| 41 | deb: "/tmp/{{ item.name }}" |
| 42 | state: present |
| 43 | with_items: "{{ ovs_fabric_packages }}" |
| 44 | when: enable_fabric |
| 45 | |
| 46 | - name: Create OVS bridges for CiaB |
| 47 | openvswitch_bridge: |
| 48 | bridge: "{{ item }}" |
| 49 | state: present |
| 50 | with_items: "{{ ovs_bridges }}" |
| 51 | |
| 52 | - name: Create patch ports |
| 53 | openvswitch_port: |
| 54 | bridge: "{{ item.bridge }}" |
| 55 | port: "{{ item.port }}" |
| 56 | set: "Interface {{ item.port }} type=patch" |
| 57 | with_items: "{{ ovs_patch_ports }}" |
| 58 | |
| 59 | - name: Create peers |
| 60 | openvswitch_port: |
| 61 | bridge: "{{ item.bridge }}" |
| 62 | port: "{{ item.port }}" |
| 63 | set: "Interface {{ item.port }} options:peer={{ item.peer }}" |
| 64 | with_items: "{{ ovs_patch_ports }}" |
| 65 | |
| 66 | # "set" argument to openvswitch_bridge wasn't working... |
| 67 | - name: Set bridges to OpenFlow 1.3 |
| 68 | command: ovs-vsctl set bridge {{ item }} protocols=OpenFlow13 |
| 69 | when: enable_fabric |
| 70 | with_items: "{{ ovs_bridges }}" |
| 71 | tags: |
| 72 | - skip_ansible_lint # running a sub job |
| 73 | |
| 74 | - name: Add ONOS fabric controller |
| 75 | command: ovs-vsctl set-controller {{ item }} tcp:{{ ovs_controller_ip }}:{{ ovs_controller_port }} |
| 76 | when: enable_fabric |
| 77 | with_items: "{{ ovs_bridges }}" |
| 78 | tags: |
| 79 | - skip_ansible_lint # running a sub job |