-
Notifications
You must be signed in to change notification settings - Fork 1
/
sample.yml
188 lines (174 loc) · 7.27 KB
/
sample.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
- hosts: all
vars_prompt:
- name: my_config
default: "sample_config"
prompt: "Which config file you'd like to use?"
private: no
vars_files:
- "{{ my_config }}.yml"
- hosts: keystone
vars_files:
- "{{ my_config }}.yml"
vars:
tasks:
- keystone_user: tenant="{{ tenant }}"
tenant_description="{{ tenant }}"
login_user="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
state=present
register: project_tenant
- keystone_user: tenant="{{ keystone_admin_tenant }}"
tenant_description="{{ tenant }}"
login_user="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
state=present
register: admin_tenant
- hosts: neutron-controller
vars_files:
- "{{ my_config }}.yml"
tasks:
- name: create private net
quantum_network: name=private
state=present
tenant_name="{{ tenant }}"
auth_url="{{ auth_url }}"
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
register: priv_net
- name: create private subnet
quantum_subnet: name=private-subnet1
network_name=private
cidr={{ sample_priv_net_cidr }}
dns_nameservers={{ sample_priv_net_dns }}
state=present
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
register: priv_subnet
- name: create public net
quantum_network: name=public
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
router_external=yes
shared=yes
register: pub_net
- name: create public subnet
quantum_subnet: name=public-subnet1
network_name=public
cidr={{ sample_pub_net_cidr }}
allocation_pool_start={{ sample_pub_net_start }}
allocation_pool_end={{ sample_pub_net_end }}
gateway_ip={{ sample_pub_net_gw }}
dns_nameservers={{ sample_pub_net_dns }}
enable_dhcp=no
state=present
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
register: pub_subnet
- hosts: glance
vars_files:
- "{{ my_config }}.yml"
tasks:
- name: add image to glance
glance_image: login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
region_name="{{ region }}"
auth_url="{{ auth_url }}"
name={{ sample_image_name }}
container_format=bare
disk_format=qcow2
state=present
file={{ sample_image_file }}
register: sample_img
- hosts: nova-controller
vars_files:
- "{{ my_config }}.yml"
tasks:
- nova_compute:
state: present
login_username: "{{ keystone_admin_username }}"
login_password: "{{ keystone_admin_password }}"
login_tenant_name: "{{ keystone_admin_tenant }}"
name: "{{ sample_instance_name }}"
image_id: "{{ sample_img.id }}"
wait_for: 200
flavor_id: "{{ sample_flavor_id }}"
nics:
- net-id: "{{ priv_net.id }}"
register: myfirstinstance
- script: files/nova-secgroup.sh
ignore_errors: True
- hosts: neutron-controller
vars_files:
- "{{ my_config }}.yml"
tasks:
- name: create router
quantum_router: name=real_router
state=present
tenant_name="{{ tenant }}"
auth_url="{{ auth_url }}"
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
register: real_router
- name: add interface to a router
quantum_router_interface:
router_name=real_router
subnet_name=private-subnet1
state=present
tenant_name="{{ tenant }}"
auth_url="{{ auth_url }}"
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
register: router_priv_net
- name: add gateway interface to a router
quantum_router_gateway:
router_name=real_router
network_name=public
state=present
auth_url="{{ auth_url }}"
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
register: router_priv_net
- name: add floating IP
quantum_floating_ip:
network_name=public
internal_network_name=private
instance_name={{ sample_instance_name }}
state=present
auth_url="{{ auth_url }}"
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
when: sample_pub_net_ip is not defined
- name: associate floating IP
quantum_floating_ip_associate:
ip_address={{ sample_pub_net_ip }}
instance_name={{ sample_instance_name }}
state=present
auth_url="{{ auth_url }}"
login_username="{{ keystone_admin_username }}"
login_password="{{ keystone_admin_password }}"
login_tenant_name="{{ keystone_admin_tenant }}"
when: sample_pub_net_ip is defined
### Missing statements:
# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
## - name: add floating IP
## quantum_floating_ip_associate:
## ip_address=192.168.0.240
## instance_name=MyFirstInstance
## state=present
## auth_url="{{ auth_url }}"
## login_username="{{ keystone_admin_username }}"
## login_password="{{ keystone_admin_password }}"
## login_tenant_name="{{ keystone_admin_tenant }}"