blob: eb4f5956db800823ff6de862a50a89a77033abbb [file] [log] [blame]
Zack Williamsdb373ef2018-04-01 14:10:21 -07001---
Matteo Scandolof0441032017-08-08 13:05:26 -07002# 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
Scott Bakerb63ea792016-08-11 10:24:48 -070016- hosts: 127.0.0.1
17 connection: local
18 tasks:
Zack Williamsdb373ef2018-04-01 14:10:21 -070019
Scott Bakerb63ea792016-08-11 10:24:48 -070020 - os_network:
Zack Williamsdb373ef2018-04-01 14:10:21 -070021 auth:
Zack Williams9cb1f3a2017-08-20 19:35:03 -070022 auth_url: "{{ endpoint }}"
23 username: "{{ admin_user }}"
24 password: "{{ admin_password }}"
25 project_name: "{{ admin_project }}"
Zack Williamsdb373ef2018-04-01 14:10:21 -070026 interface: "admin"
27 name: "{{ name }}"
28 shared: true
29 {% if not delete -%}
30 state: present
31 {% else -%}
32 state: absent
33 {% endif -%}
Scott Bakerb63ea792016-08-11 10:24:48 -070034
35{% if not delete %}
36 - os_subnet:
Zack Williams9cb1f3a2017-08-20 19:35:03 -070037 auth:
38 auth_url: "{{ endpoint }}"
39 username: "{{ admin_user }}"
40 password: "{{ admin_password }}"
41 project_name: "{{ admin_project }}"
Zack Williamsdb373ef2018-04-01 14:10:21 -070042 interface: "admin"
Zack Williams9cb1f3a2017-08-20 19:35:03 -070043 name: "{{ subnet_name }}"
44 network_name: "{{ name }}"
Scott Bakerb63ea792016-08-11 10:24:48 -070045 {% if not delete -%}
46 state: present
Zack Williams9cb1f3a2017-08-20 19:35:03 -070047 cidr: "{{ cidr }}"
48 dns_nameservers: "8.8.8.8"
Scott Bakerb63ea792016-08-11 10:24:48 -070049 {% if use_vtn -%}
Zack Williams9cb1f3a2017-08-20 19:35:03 -070050 gateway_ip: "{{ gateway }}"
51 {% else -%}
52 no_gateway_ip: yes
Scott Bakerb63ea792016-08-11 10:24:48 -070053 {% endif -%}
54 {% if start_ip -%}
Zack Williams9cb1f3a2017-08-20 19:35:03 -070055 allocation_pool_start: "{{ start_ip }}"
Scott Bakerb63ea792016-08-11 10:24:48 -070056 {% endif -%}
57 {% if end_ip -%}
Zack Williams9cb1f3a2017-08-20 19:35:03 -070058 allocation_pool_end: "{{ end_ip }}"
Scott Bakerb63ea792016-08-11 10:24:48 -070059 {% endif -%}
60 {% else -%}
61 state: absent
62 {% endif -%}
Scott Bakerb63ea792016-08-11 10:24:48 -070063{% endif %}
64