-
Notifications
You must be signed in to change notification settings - Fork 8
/
04-neutron.sh
134 lines (106 loc) · 5.33 KB
/
04-neutron.sh
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
#!/bin/bash
source os.conf
source admin-openrc
##### Nutron Networking Service #####
mysql -u root -p$PASSWORD -e "SHOW DATABASES;" | grep neutron > /dev/null 2>&1 && echo "neutron database already exists" || mysql -u root -p$PASSWORD -e "CREATE DATABASE neutron; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '$PASSWORD'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '$PASSWORD';"
openstack user list | grep neutron > /dev/null 2>&1 && echo "neutron user already exists" || openstack user create --domain default --password $PASSWORD neutron
openstack role add --project service --user neutron admin
openstack service list | grep neutron > /dev/null 2>&1 && echo "neutron service already exists" || openstack service create --name neutron --description "OpenStack Networking service" network
openstack endpoint list | grep public | grep neutron > /dev/null 2>&1 && echo "neutron public endpoint already exists" || openstack endpoint create --region RegionOne network public http://$HOSTNAME:9696
openstack endpoint list | grep internal | grep neutron > /dev/null 2>&1 && echo "neutron internal endpoint exists" || openstack endpoint create --region RegionOne network internal http://$HOSTNAME:9696
openstack endpoint list | grep admin | grep neutron > /dev/null 2>&1 && echo "neutron admin endpoint already exists" || openstack endpoint create --region RegionOne neutron admin http://$HOSTNAME:9696
echo -n "installing packages... " && zypper -n in --no-recommends openstack-neutron openstack-neutron-server openstack-neutron-linuxbridge-agent openstack-neutron-l3-agent openstack-neutron-dhcp-agent openstack-neutron-metadata-agent bridge-utils > /dev/null 2>&1 && echo "done"
[ ! -f /etc/neutron/neutron.conf.orig ] && cp -v /etc/neutron/neutron.conf /etc/neutron/neutron.conf.orig
cat << _EOF_ > /etc/neutron/neutron.conf
[DEFAULT]
verbose = True
core_plugin = ml2
service_plugins = router
state_path = /var/lib/neutron
log_dir = /var/log/neutron
allow_overlapping_ips = True
transport_url = rabbit://openstack:$PASSWORD@$HOSTNAME
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
[agent]
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
[oslo_concurrency]
lock_path = /var/run/neutron
[keystone_authtoken]
auth_uri = http://$HOSTNAME:5000
auth_url = http://$HOSTNAME:35357
memcached_servers = $HOSTNAME:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = $PASSWORD
[database]
connection = mysql+pymysql://neutron:$PASSWORD@$HOSTNAME/neutron
[nova]
auth_url = http://$HOSTNAME:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = $PASSWORD
_EOF_
[ ! -f /etc/neutron/plugins/ml2/ml2_conf.ini.orig ] && cp -v /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.orig
cat << _EOF_ > /etc/neutron/plugins/ml2/ml2_conf.ini
[DEFAULT]
[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = external
[ml2_type_vxlan]
vni_ranges = 1:1000
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
enable_ipset = True
_EOF_
[ ! -f /etc/neutron/plugins/ml2/linuxbridge_agent.ini.orig ] && cp -v /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.orig
cat << _EOF_ > /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[DEFAULT]
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
[linux_bridge]
physical_interface_mappings = external:$INTEXT
[vxlan]
enable_vxlan = True
local_ip = $IPMAN
l2_population = True
_EOF_
[ ! -f /etc/neutron/l3_agent.ini.orig ] && cp -v /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini.orig
cat << _EOF_ > /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
_EOF_
[ ! -f /etc/neutron/dhcp_agent.ini.orig ] && cp -v /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.orig
cat << _EOF_ > /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_delete_namespaces = True
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
_EOF_
[ ! -f /etc/neutron/metadata_agent.ini.orig ] && cp -v /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.orig
cat << _EOF_ > /etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_ip = $HOSTNAME
metadata_proxy_shared_secret = $PASSWORD
_EOF_
systemctl enable openstack-neutron.service openstack-neutron-linuxbridge-agent.service openstack-neutron-dhcp-agent.service openstack-neutron-metadata-agent.service openstack-neutron-l3-agent.service
systemctl restart openstack-neutron.service openstack-neutron-linuxbridge-agent.service openstack-neutron-dhcp-agent.service openstack-neutron-metadata-agent.service openstack-neutron-l3-agent.service
systemctl status openstack-neutron.service openstack-neutron-linuxbridge-agent.service openstack-neutron-dhcp-agent.service openstack-neutron-metadata-agent.service openstack-neutron-l3-agent.service
sleep 5
neutron ext-list
openstack network agent list