forked from saikrishnaa/Ansible-Openstack-Queens-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Neutron.yml
228 lines (212 loc) · 10.3 KB
/
Neutron.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
---
- name: login as controller
hosts: controller
remote_user: root
become: yes
vars:
mysql_root_pass: root
tasks:
- name: install neturon packages
apt:
name: "{{ item }}"
state: present
with_items:
- neutron-server
- neutron-plugin-ml2
- neutron-linuxbridge-agent
- neutron-l3-agent
- neutron-dhcp-agent
- neutron-metadata-agent
- name: update neutron config file
ini_file:
path: /etc/neutron/neutron.conf
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "database", option: "connection", value: "mysql+pymysql://neutron:root@controller/neutron" }
- { section: "DEFAULT", option: "core_plugin", value: "ml2" }
- { section: "DEFAULT", option: "service_plugins", value: "router" }
- { section: "DEFAULT", option: "allow_overlapping_ips", value: "true" }
- { section: "DEFAULT", option: "transport_url", value: "rabbit://openstack:root@controller" }
- { section: "DEFAULT", option: "auth_strategy", value: "keystone" }
- { section: "keystone_authtoken", option: "auth_uri", value: "http://controller:5000" }
- { section: "keystone_authtoken", option: "auth_url", value: "http://controller:5000" }
- { section: "keystone_authtoken", option: "memcached_servers", value: "controller:11211" }
- { section: "keystone_authtoken", option: "auth_type", value: "password" }
- { section: "keystone_authtoken", option: "project_domain_name", value: "default" }
- { section: "keystone_authtoken", option: "user_domain_name", value: "default" }
- { section: "keystone_authtoken", option: "project_name", value: "service" }
- { section: "keystone_authtoken", option: "username", value: "neutron" }
- { section: "keystone_authtoken", option: "password", value: "root" }
- { section: "DEFAULT", option: "notify_nova_on_port_status_changes", value: "true" }
- { section: "DEFAULT", option: "notify_nova_on_port_data_changes", value: "true" }
- { section: "nova", option: "auth_url", value: "http://controller:5000" }
- { section: "nova", option: "auth_type", value: "password" }
- { section: "nova", option: "project_domain_name", value: "default" }
- { section: "nova", option: "user_domain_name", value: "default" }
- { section: "nova", option: "region_name", value: "password" }
- { section: "nova", option: "project_name", value: "service" }
- { section: "nova", option: "username", value: "nova" }
- { section: "nova", option: "password", value: "root" }
- { section: "oslo_concurrency", option: "lock_path", value: "/var/lib/neutron/tmp" }
- name: update ml2_conf config file
ini_file:
path: /etc/neutron/plugins/ml2/ml2_conf.ini
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "ml2", option: "type_drivers", value: "flat,vlan,vxlan" }
- { section: "ml2", option: "tenant_network_types", value: "vxlan" }
- { section: "ml2", option: "mechanism_drivers", value: "linuxbridge,l2population" }
- { section: "ml2", option: "extension_drivers", value: "port_security" }
- { section: "ml2_type_flat", option: "flat_networks", value: "provider" }
- { section: "ml2_type_vxlan", option: "vni_ranges", value: "1:1000" }
- { section: "securitygroup", option: "enable_ipset", value: "true" }
- name: update linuxbridge_agent config file
ini_file:
path: /etc/neutron/plugins/ml2/linuxbridge_agent.ini
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "linux_bridge", option: "physical_interface_mappings", value: "provider:enp0s3" }
- { section: "vxlan", option: "enable_vxlan", value: "true" }
- { section: "vxlan", option: "local_ip", value: "10.0.0.11" }
- { section: "vxlan", option: "l2_population", value: "true" }
- { section: "securitygroup", option: "enable_security_group", value: "true" }
- { section: "securitygroup", option: "firewall_driver", value: "neutron.agent.linux.iptables_firewall.IptablesFirewallDriver" }
- name: update l3_agent config file
ini_file:
path: /etc/neutron/l3_agent.ini
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "DEFAULT", option: "interface_driver", value: "linuxbridge" }
- name: update dhcp_agent config file
ini_file:
path: /etc/neutron/dhcp_agent.ini
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "DEFAULT", option: "interface_driver", value: "linuxbridge" }
- { section: "DEFAULT", option: "dhcp_driver", value: "neutron.agent.linux.dhcp.Dnsmasq" }
- { section: "DEFAULT", option: "enable_isolated_metadata", value: "true" }
- name: update metadata_agent config file
ini_file:
path: /etc/neutron/metadata_agent.ini
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "DEFAULT", option: "nova_metadata_host", value: "controller" }
- { section: "DEFAULT", option: "metadata_proxy_shared_secret", value: "root" }
- name: update nova config file
ini_file:
path: /etc/nova/nova.conf
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "neutron", option: "url", value: "http://controller:9696" }
- { section: "neutron", option: "auth_url", value: "http://controller:5000" }
- { section: "neutron", option: "auth_type", value: "password" }
- { section: "neutron", option: "project_domain_name", value: "default" }
- { section: "neutron", option: "user_domain_name", value: "default" }
- { section: "neutron", option: "region_name", value: "RegionOne" }
- { section: "neutron", option: "project_name", value: "service" }
- { section: "neutron", option: "username", value: "neutron" }
- { section: "neutron", option: "password", value: "root" }
- { section: "neutron", option: "service_metadata_proxy", value: "true" }
- { section: "neutron", option: "metadata_proxy_shared_secret", value: "root" }
- name: db sync neturon
shell: su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
# ignore_errors: yes
- name: restart services
service:
name: "{{ item }}"
state: restarted
with_items:
- "nova-api"
- "neutron-server"
- "neutron-linuxbridge-agent"
- "neutron-dhcp-agent"
- "neutron-metadata-agent"
- "neutron-l3-agent"
- name: login as compute
hosts: compute
remote_user: root
become: yes
tasks:
- name: install neutron-linuxbridge
apt:
name: neutron-linuxbridge-agent
state: present
- name: update neutron config file
ini_file:
path: /etc/neutron/neutron.conf
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "DEFAULT", option: "transport_url", value: "rabbit://openstack:root@controller" }
- { section: "DEFAULT", option: "auth_strategy", value: "keystone" }
- { section: "keystone_authtoken", option: "auth_uri", value: "http://controller:5000"}
- { section: "keystone_authtoken", option: "auth_url", value: "http://controller:5000"}
- { section: "keystone_authtoken", option: "memcached_servers", value: "controller:11211"}
- { section: "keystone_authtoken", option: "auth_type", value: "password"}
- { section: "keystone_authtoken", option: "project_domain_name", value: "default"}
- { section: "keystone_authtoken", option: "user_domain_name", value: "default"}
- { section: "keystone_authtoken", option: "project_name", value: "service"}
- { section: "keystone_authtoken", option: "username", value: "neutron"}
- { section: "keystone_authtoken", option: "password", value: "root"}
- { section: "oslo_concurrency", option: "lock_path", value: "/var/lib/neutron/tmp"}
- name: update linuxbridge_agent config file
ini_file:
path: /etc/neutron/plugins/ml2/linuxbridge_agent.ini
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "linux_bridge", option: "physical_interface_mappings", value: "provider:enp0s3" }
- { section: "vxlan", option: "enable_vxlan", value: "true" }
- { section: "vxlan", option: "local_ip", value: "10.0.0.31"}
- { section: "vxlan", option: "l2_population", value: "true"}
- { section: "securitygroup", option: "enable_security_group", value: "true"}
- { section: "securitygroup", option: "firewall_driver", value: "neutron.agent.linux.iptables_firewall.IptablesFirewallDriver"}
- name: update nova config file
ini_file:
path: /etc/nova/nova.conf
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "neutron", option: "url", value: "http://controller:9696"}
- { section: "neutron", option: "auth_url", value: "http://controller:5000"}
- { section: "neutron", option: "auth_type", value: "password"}
- { section: "neutron", option: "project_domain_name", value: "default"}
- { section: "neutron", option: "user_domain_name", value: "default"}
- { section: "neutron", option: "region_name", value: "RegionOne"}
- { section: "neutron", option: "project_name", value: "service"}
- { section: "neutron", option: "username", value: "neutron"}
- { section: "neutron", option: "password", value: "root"}
- name: nova services status
service:
name: "{{ item }}"
state: restarted
with_items:
- "nova-compute"
- "neutron-linuxbridge-agent"
- name: login as controller
hosts: controller
remote_user: root
become: yes
tasks:
- name: launch of the neutron agents
shell: "{{ item }}"
with_items:
- "sh neutron-verification.sh"
# - "openstack network agent list"