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 | |
Andy Bavier | 8b39120 | 2018-02-12 09:37:16 -0700 | [diff] [blame^] | 59 | # This returns OK but doesn't actually set up the peer |
| 60 | #- name: Create peers |
| 61 | # openvswitch_port: |
| 62 | # bridge: "{{ item.bridge }}" |
| 63 | # port: "{{ item.port }}" |
| 64 | # set: "Interface {{ item.port }} options:peer={{ item.peer }}" |
| 65 | # with_items: "{{ ovs_patch_ports }}" |
| 66 | |
Andy Bavier | b36b84e | 2017-08-10 14:46:32 -0700 | [diff] [blame] | 67 | - name: Create peers |
Andy Bavier | 8b39120 | 2018-02-12 09:37:16 -0700 | [diff] [blame^] | 68 | command: ovs-vsctl set interface {{ item.port }} options:peer={{ item.peer }} |
Andy Bavier | b36b84e | 2017-08-10 14:46:32 -0700 | [diff] [blame] | 69 | with_items: "{{ ovs_patch_ports }}" |
Andy Bavier | 8b39120 | 2018-02-12 09:37:16 -0700 | [diff] [blame^] | 70 | tags: |
| 71 | - skip_ansible_lint # running a sub job |
Andy Bavier | b36b84e | 2017-08-10 14:46:32 -0700 | [diff] [blame] | 72 | |
| 73 | # "set" argument to openvswitch_bridge wasn't working... |
| 74 | - name: Set bridges to OpenFlow 1.3 |
| 75 | command: ovs-vsctl set bridge {{ item }} protocols=OpenFlow13 |
| 76 | when: enable_fabric |
| 77 | with_items: "{{ ovs_bridges }}" |
| 78 | tags: |
| 79 | - skip_ansible_lint # running a sub job |
| 80 | |
| 81 | - name: Add ONOS fabric controller |
| 82 | command: ovs-vsctl set-controller {{ item }} tcp:{{ ovs_controller_ip }}:{{ ovs_controller_port }} |
| 83 | when: enable_fabric |
| 84 | with_items: "{{ ovs_bridges }}" |
| 85 | tags: |
| 86 | - skip_ansible_lint # running a sub job |