blob: d3613d1f9081ee51f91fcd601b2f238f5bb1c3f6 [file] [log] [blame]
Matteo Scandolof0441032017-08-08 13:05:26 -07001
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 Bakerb63ea792016-08-11 10:24:48 -070017---
18- hosts: 127.0.0.1
19 connection: local
20 tasks:
21 - os_network:
22 name: {{ name }}
23 shared: true
24 {% if not delete -%}
25 state: present
26 {% else -%}
27 state: absent
28 {% endif -%}
29 auth:
30 auth_url: {{ endpoint }}
31 username: {{ admin_user }}
32 password: {{ admin_password }}
33 project_name: {{ admin_project }}
34
35{% if not delete %}
36 - os_subnet:
37 name: {{ subnet_name }}
38 network_name: {{ name }}
39 {% if not delete -%}
40 state: present
41 cidr: {{ cidr }}
42 dns_nameservers: 8.8.8.8
43 {% if use_vtn -%}
44 gateway_ip: {{ gateway }}
45 {% endif -%}
46 {% if start_ip -%}
47 allocation_pool_start: {{ start_ip }}
48 {% endif -%}
49 {% if end_ip -%}
50 allocation_pool_end: {{ end_ip }}
51 {% endif -%}
52 {% else -%}
53 state: absent
54 {% endif -%}
55 auth:
56 auth_url: {{ endpoint }}
57 username: {{ admin_user }}
58 password: {{ admin_password }}
59 project_name: {{ admin_project }}
60
61{% if not use_vtn -%}
62# until we get 'no-gateway-ip' arg to os_subnet, in Ansible 2.2
63# https://github.com/ansible/ansible-modules-core/pull/3736
64 - command:
65 neutron \
66 --os-auth-url {{ endpoint }} \
67 --os-username {{ admin_user }} \
68 --os-password {{ admin_password }} \
69 --os-tenant-name {{ admin_project }} \
70 subnet-update --no-gateway {{ subnet_name }}
71{% endif -%}
72
73{% endif %}
74