blob: 7b6075c99b808b59c80e2e404e4e9b6892f57e6e [file] [log] [blame]
Scott Bakerb63ea792016-08-11 10:24:48 -07001---
2- hosts: 127.0.0.1
3 connection: local
4 tasks:
5 - os_network:
6 name: {{ name }}
7 shared: true
8 {% if not delete -%}
9 state: present
10 {% else -%}
11 state: absent
12 {% endif -%}
13 auth:
14 auth_url: {{ endpoint }}
15 username: {{ admin_user }}
16 password: {{ admin_password }}
17 project_name: {{ admin_project }}
18
19{% if not delete %}
20 - os_subnet:
21 name: {{ subnet_name }}
22 network_name: {{ name }}
23 {% if not delete -%}
24 state: present
25 cidr: {{ cidr }}
26 dns_nameservers: 8.8.8.8
27 {% if use_vtn -%}
28 gateway_ip: {{ gateway }}
29 {% endif -%}
30 {% if start_ip -%}
31 allocation_pool_start: {{ start_ip }}
32 {% endif -%}
33 {% if end_ip -%}
34 allocation_pool_end: {{ end_ip }}
35 {% endif -%}
36 {% else -%}
37 state: absent
38 {% endif -%}
39 auth:
40 auth_url: {{ endpoint }}
41 username: {{ admin_user }}
42 password: {{ admin_password }}
43 project_name: {{ admin_project }}
44
45{% if not use_vtn -%}
46# until we get 'no-gateway-ip' arg to os_subnet, in Ansible 2.2
47# https://github.com/ansible/ansible-modules-core/pull/3736
48 - command:
49 neutron \
50 --os-auth-url {{ endpoint }} \
51 --os-username {{ admin_user }} \
52 --os-password {{ admin_password }} \
53 --os-tenant-name {{ admin_project }} \
54 subnet-update --no-gateway {{ subnet_name }}
55{% endif -%}
56
57{% endif %}
58