diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-03-23 21:06:52 +0000 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2015-04-10 20:17:43 +0100 |
commit | 14a8942fea5f99db2b0344594006bb2e67838245 (patch) | |
tree | 21349eea61c00b3285a9338bc762a9a1543d3e94 /openstack-neutron.configure | |
parent | f3bb13a4b620488b41f2b3901e45fa2be459d882 (diff) | |
download | definitions-14a8942fea5f99db2b0344594006bb2e67838245.tar.gz |
WIP: Add OpenStack initial configuration
TODO: Split this out into:
1. initial config (openstack/etc) default values
2+. as many individual changes to initial config as possible to extract,
including support scripts and configuration extensions
Diffstat (limited to 'openstack-neutron.configure')
-rw-r--r-- | openstack-neutron.configure | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/openstack-neutron.configure b/openstack-neutron.configure new file mode 100644 index 00000000..5f5754a9 --- /dev/null +++ b/openstack-neutron.configure @@ -0,0 +1,67 @@ +#!/bin/bash + +# Copyright (C) 2014-2015 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +set -e + +ROOT="$1" + +########################################################################## +# Substitutions in configuration files # +########################################################################## + +cat <<EOF > "$ROOT"/etc/openstack-neutron-setup.sed +s/##NEUTRON_SERVICE_USER##/$NEUTRON_SERVICE_USER/g +s/##NEUTRON_SERVICE_PASSWORD##/$NEUTRON_SERVICE_PASSWORD/g +s/##NEUTRON_DB_USER##/$NEUTRON_DB_USER/g +s/##NEUTRON_DB_PASSWORD##/$NEUTRON_DB_PASSWORD/g +s/##NEUTRON_PUBLIC_URL##/$NEUTRON_PUBLIC_URL/g +s/##NEUTRON_INTERNAL_URL##/$NEUTRON_INTERNAL_URL/g +s/##NEUTRON_ADMIN_URL##/$NEUTRON_ADMIN_URL/g +s/##METADATA_PROXY_SHARED_SECRET##/$METADATA_PROXY_SHARED_SECRET/g +EOF + +sed -f "$ROOT"/etc/openstack-neutron-setup.sed -i \ + "$ROOT"/etc/neutron/neutron.conf \ + "$ROOT"/etc/neutron/metadata_agent.ini \ + "$ROOT"/etc/nova/nova.conf \ + "$ROOT"/usr/share/openstack/openstack-neutron-setup + +########################################################################## +# Create the links to enable the neutron systemd services # +########################################################################## +services=("openstack-neutron-network-configuration-one-node.service" \ + "openvswitch-create-links-one-node.service" \ + "openstack-neutron-dhcp-agent.service" \ + "openstack-neutron-l3-agent.service" \ + "openstack-neutron-metadata-agent.service" \ + "openstack-neutron-ovs-cleanup.service" \ + "openstack-neutron-plugin-openvswitch-agent.service" \ + "openstack-neutron-server.service" \ + "openstack-neutron-setup.service") + +for service in ${services[@]}; do + ln -sf "/etc/systemd/system/$service" \ + "$ROOT/etc/systemd/system/multi-user.target.wants/$service" +done + +########################################################################## +# Add neutron to sudoers controlling which commands is running as a root # +# using the openstack rootwrap. # +########################################################################## +install -D -m 0440 /proc/self/fd/0 <<'EOF' "$ROOT"/etc/sudoers.d/neutron-rootwrap +neutron ALL=(root) NOPASSWD: /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf * +EOF |