Matteo Scandolo | f044103 | 2017-08-08 13:05:26 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 17 | --- |
| 18 | - hosts: 127.0.0.1 |
| 19 | connection: local |
| 20 | tasks: |
| 21 | - os_network: |
Zack Williams | 9cb1f3a | 2017-08-20 19:35:03 -0700 | [diff] [blame] | 22 | auth: |
| 23 | auth_url: "{{ endpoint }}" |
| 24 | username: "{{ admin_user }}" |
| 25 | password: "{{ admin_password }}" |
| 26 | project_name: "{{ admin_project }}" |
| 27 | name: "{{ name }}" |
| 28 | shared: true |
| 29 | {% if not delete -%} |
| 30 | state: present |
| 31 | {% else -%} |
| 32 | state: absent |
| 33 | {% endif -%} |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 34 | |
| 35 | {% if not delete %} |
| 36 | - os_subnet: |
Zack Williams | 9cb1f3a | 2017-08-20 19:35:03 -0700 | [diff] [blame] | 37 | auth: |
| 38 | auth_url: "{{ endpoint }}" |
| 39 | username: "{{ admin_user }}" |
| 40 | password: "{{ admin_password }}" |
| 41 | project_name: "{{ admin_project }}" |
| 42 | name: "{{ subnet_name }}" |
| 43 | network_name: "{{ name }}" |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 44 | {% if not delete -%} |
| 45 | state: present |
Zack Williams | 9cb1f3a | 2017-08-20 19:35:03 -0700 | [diff] [blame] | 46 | cidr: "{{ cidr }}" |
| 47 | dns_nameservers: "8.8.8.8" |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 48 | {% if use_vtn -%} |
Zack Williams | 9cb1f3a | 2017-08-20 19:35:03 -0700 | [diff] [blame] | 49 | gateway_ip: "{{ gateway }}" |
| 50 | {% else -%} |
| 51 | no_gateway_ip: yes |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 52 | {% endif -%} |
| 53 | {% if start_ip -%} |
Zack Williams | 9cb1f3a | 2017-08-20 19:35:03 -0700 | [diff] [blame] | 54 | allocation_pool_start: "{{ start_ip }}" |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 55 | {% endif -%} |
| 56 | {% if end_ip -%} |
Zack Williams | 9cb1f3a | 2017-08-20 19:35:03 -0700 | [diff] [blame] | 57 | allocation_pool_end: "{{ end_ip }}" |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 58 | {% endif -%} |
| 59 | {% else -%} |
| 60 | state: absent |
| 61 | {% endif -%} |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 62 | {% endif %} |
| 63 | |