summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clusters/openstack-installer.morph9
-rw-r--r--openstack-neutron.configure82
-rw-r--r--openstack/manifest6
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-config-setup.service13
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-db-setup.service13
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-dhcp-agent.service5
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-l3-agent.service5
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-metadata-agent.service5
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-ovs-cleanup.service5
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-plugin-openvswitch-agent.service5
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-server.service5
-rw-r--r--openstack/usr/lib/systemd/system/openstack-neutron-setup.service10
-rw-r--r--openstack/usr/share/openstack/neutron-config.yml48
-rw-r--r--openstack/usr/share/openstack/neutron-db.yml51
-rw-r--r--openstack/usr/share/openstack/neutron.yml109
15 files changed, 225 insertions, 146 deletions
diff --git a/clusters/openstack-installer.morph b/clusters/openstack-installer.morph
index 4103ea0..5cc7c5d 100644
--- a/clusters/openstack-installer.morph
+++ b/clusters/openstack-installer.morph
@@ -74,6 +74,9 @@ systems:
NEUTRON_SERVICE_PASSWORD: veryinsecure
NEUTRON_DB_USER: neutronDB
NEUTRON_DB_PASSWORD: veryinsecure
+ NEUTRON_ENABLE_AGENT: False
+ NEUTRON_ENABLE_MANAGER: True
+ NEUTRON_ENABLE_CONTROLLER: False
METADATA_PROXY_SHARED_SECRET: novaneutronmetasecret
HOSTS_SELF: 10.24.1.83 threenode-network
HOSTS_NETWORK: 10.0.0.1 threenode-network.os-mgmt
@@ -107,6 +110,9 @@ systems:
CINDER_DB_USER: cinderDB
CINDER_DB_PASSWORD: veryinsecure
CINDER_DEVICE: /dev/sdb
+ NEUTRON_ENABLE_AGENT: False
+ NEUTRON_ENABLE_MANAGER: False
+ NEUTRON_ENABLE_CONTROLLER: True
METADATA_PROXY_SHARED_SECRET: novaneutronmetasecret
HOSTS_SELF: 10.0.0.2 threenode-controller
EXTERNAL_INTERFACE: enp2s0
@@ -136,6 +142,9 @@ systems:
CINDER_DB_USER: cinderDB
CINDER_DB_PASSWORD: veryinsecure
CINDER_DEVICE: /dev/sdb
+ NEUTRON_ENABLE_AGENT: True
+ NEUTRON_ENABLE_MANAGER: False
+ NEUTRON_ENABLE_CONTROLLER: False
METADATA_PROXY_SHARED_SECRET: novaneutronmetasecret
HOSTS_SELF: 10.0.0.3 threenode-compute
EXTERNAL_INTERFACE: eno1
diff --git a/openstack-neutron.configure b/openstack-neutron.configure
index 50a6d1e..04a0da5 100644
--- a/openstack-neutron.configure
+++ b/openstack-neutron.configure
@@ -18,19 +18,16 @@ set -e
ROOT="$1"
-##########################################################################
-
-ln -sf "/usr/lib/systemd/system/openstack-neutron-setup.service" \
- "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-neutron-setup.service"
+enable(){
+ ln -sf "/usr/lib/systemd/system/openstack-neutron-$1.service" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-neutron-$1.service"
+}
-#############################################
-# Ensure /var/run is an appropriate symlink #
-#############################################
+unrecognised_value(){
+ eval echo Unrecognised value \$$1 for $1 >&2
+ exit 1
+}
-if ! link="$(readlink "$ROOT/var/run")" || [ "$link" != ../run ]; then
- rm -rf "$ROOT/var/run"
- ln -s ../run "$ROOT/var/run"
-fi
##########################################################################
# Check variables
@@ -51,7 +48,7 @@ if [ -z "$NEUTRON_SERVICE_USER" -a \
-z "$CONTROLLER_HOST_ADDRESS" -a \
-z "$MANAGEMENT_INTERFACE_IP_ADDRESS" -a \
-z "$KEYSTONE_TEMPORARY_ADMIN_TOKEN" ]; then
- # No NOVA options defined, do nothing.
+ # No Neutron options defined, do nothing.
exit 0
fi
@@ -69,10 +66,69 @@ if [ -z "$NEUTRON_SERVICE_USER" -o \
-z "$CONTROLLER_HOST_ADDRESS" -o \
-z "$MANAGEMENT_INTERFACE_IP_ADDRESS" -o \
-z "$KEYSTONE_TEMPORARY_ADMIN_TOKEN" ]; then
- echo Some options required for Nova were defined, but not all.
+ echo Some options required for Neutron were defined, but not all.
exit 1
fi
+#############################################
+# Ensure /var/run is an appropriate symlink #
+#############################################
+
+if ! link="$(readlink "$ROOT/var/run")" || [ "$link" != ../run ]; then
+ rm -rf "$ROOT/var/run"
+ ln -s ../run "$ROOT/var/run"
+fi
+
+###################
+# Enable services #
+###################
+
+if [ x"${NEUTRON_ENABLE_CONTROLLER=True}" = xTrue -o \
+ x"${NEUTRON_ENABLE_MANAGER=True}" = xTrue -o \
+ x"${NEUTRON_ENABLE_AGENT=True}" = xTrue ]; then
+ enable config-setup
+fi
+
+case "${NEUTRON_ENABLE_CONTROLLER}" in
+True|yes|y)
+ enable config-setup
+ enable db-setup
+ enable server
+ ;;
+False|no|n|'')
+ ;;
+*)
+ unrecognised_value NEUTRON_ENABLE_CONTROLLER
+ ;;
+esac
+
+case "${NEUTRON_ENABLE_MANAGER}" in
+True|yes|y)
+ enable config-setup
+ enable ovs-cleanup
+ enable dhcp-agent
+ enable l3-agent
+ enable plugin-openvswitch-agent
+ ;;
+False|no|n|'')
+ ;;
+*)
+ unrecognised_value NEUTRON_ENABLE_MANAGER
+ ;;
+esac
+
+case "${NEUTRON_ENABLE_AGENT}" in
+True|yes|y)
+ enable config-setup
+ enable plugin-openvswitch-agent
+ ;;
+False|no|n|'')
+ ;;
+*)
+ unrecognised_value NEUTRON_ENABLE_AGENT
+ ;;
+esac
+
##########################################################################
# Generate config variable shell snippet
##########################################################################
diff --git a/openstack/manifest b/openstack/manifest
index 072c647..8911abb 100644
--- a/openstack/manifest
+++ b/openstack/manifest
@@ -32,7 +32,8 @@
0100644 0 0 /usr/share/openstack/keystone/keystone-paste.ini
0100644 0 0 /usr/share/openstack/network.yml
0040755 0 0 /usr/share/openstack/neutron
-0100644 0 0 /usr/share/openstack/neutron.yml
+0100644 0 0 /usr/share/openstack/neutron-config.yml
+0100644 0 0 /usr/share/openstack/neutron-db.yml
0100644 0 0 /usr/share/openstack/neutron/neutron.conf
0100644 0 0 /usr/share/openstack/neutron/api-paste.ini
0100644 0 0 /usr/share/openstack/neutron/policy.json
@@ -122,7 +123,8 @@
0100644 0 0 /usr/lib/systemd/system/openstack-glance-registry.service
0100644 0 0 /usr/lib/systemd/system/openstack-horizon-setup.service
0100644 0 0 /usr/lib/systemd/system/openstack-network-setup.service
-0100644 0 0 /usr/lib/systemd/system/openstack-neutron-setup.service
+0100644 0 0 /usr/lib/systemd/system/openstack-neutron-config-setup.service
+0100644 0 0 /usr/lib/systemd/system/openstack-neutron-db-setup.service
0100644 0 0 /usr/lib/systemd/system/openstack-neutron-server.service
0100644 0 0 /usr/lib/systemd/system/openstack-neutron-metadata-agent.service
0100644 0 0 /usr/lib/systemd/system/openstack-neutron-plugin-openvswitch-agent.service
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-config-setup.service b/openstack/usr/lib/systemd/system/openstack-neutron-config-setup.service
new file mode 100644
index 0000000..46e1b58
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-config-setup.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Run neutron-config-setup Ansible scripts
+ConditionPathExists=/etc/openstack/neutron.conf
+After=openstack-keystone.service openstack-keystone-setup.service
+Wants=openstack-keystone.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/ansible-playbook -v -M /usr/share/ansible/ansible-openstack-modules -i /usr/share/openstack/hosts /usr/share/openstack/neutron-config.yml
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-db-setup.service b/openstack/usr/lib/systemd/system/openstack-neutron-db-setup.service
new file mode 100644
index 0000000..4b30e78
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-db-setup.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Run neutron-db-setup Ansible scripts
+ConditionPathExists=/etc/openstack/neutron.conf
+After=network-online.target openstack-keystone.service postgres-server.service openstack-keystone-setup.service
+Wants=network-online.target openstack-keystone.service postgres-server.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/ansible-playbook -v -M /usr/share/ansible/ansible-openstack-modules -i /usr/share/openstack/hosts /usr/share/openstack/neutron-db.yml
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-dhcp-agent.service b/openstack/usr/lib/systemd/system/openstack-neutron-dhcp-agent.service
index 34a682b..cd9ed9f 100644
--- a/openstack/usr/lib/systemd/system/openstack-neutron-dhcp-agent.service
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-dhcp-agent.service
@@ -1,7 +1,8 @@
[Unit]
Description=Neutron DHCP Agent
-After=network-online.target openstack-neutron-ovs-cleanup.service
-Wants=network-online.target
+ConditionPathExists=/etc/neutron/neutron.conf
+After=network-online.target openstack-neutron-config-setup.service openstack-neutron-db-setup.service openstack-neutron-ovs-cleanup.service
+Wants=network-online.target openstack-neutron-config-setup.service
[Service]
Type=simple
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-l3-agent.service b/openstack/usr/lib/systemd/system/openstack-neutron-l3-agent.service
index bd514aa..1a6b592 100644
--- a/openstack/usr/lib/systemd/system/openstack-neutron-l3-agent.service
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-l3-agent.service
@@ -1,7 +1,8 @@
[Unit]
Description=Neutron Layer 3 Agent
-After=network-online.target openstack-neutron-ovs-cleanup.service
-Wants=network-online.target
+ConditionPathExists=/etc/neutron/neutron.conf
+After=network-online.target openstack-neutron-config-setup.service openstack-neutron-db-setup.service openstack-neutron-ovs-cleanup.service
+Wants=network-online.target openstack-neutron-config-setup.service
[Service]
Type=simple
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-metadata-agent.service b/openstack/usr/lib/systemd/system/openstack-neutron-metadata-agent.service
index 22bbf67..c96fa3a 100644
--- a/openstack/usr/lib/systemd/system/openstack-neutron-metadata-agent.service
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-metadata-agent.service
@@ -1,7 +1,8 @@
[Unit]
Description=Neutron Metadata Plugin Agent
-After=network-online.target openstack-neutron-setup.service
-Wants=network-online.target
+ConditionPathExists=/etc/neutron/neutron.conf
+After=network-online.target openstack-neutron-config-setup.service openstack-neutron-db-setup.service
+Wants=network-online.target openstack-neutron-config-setup.service
[Service]
Type=simple
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-ovs-cleanup.service b/openstack/usr/lib/systemd/system/openstack-neutron-ovs-cleanup.service
index 544531e..386f50d 100644
--- a/openstack/usr/lib/systemd/system/openstack-neutron-ovs-cleanup.service
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-ovs-cleanup.service
@@ -1,7 +1,8 @@
[Unit]
Description=Neutron OVS cleanup
-After=network-online.target openstack-neutron-setup.service openvswitch.service
-Wants=network-online.target
+ConditionPathExists=/etc/neutron/neutron.conf
+After=network-online.target openstack-neutron-config-setup.service openstack-neutron-db-setup.service openvswitch.service
+Wants=network-online.target openstack-neutron-config-setup.service
Before=openstack-neutron-plugin-openvswitch-agent.service
ConditionFileIsExecutable=/usr/bin/neutron-ovs-cleanup
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-plugin-openvswitch-agent.service b/openstack/usr/lib/systemd/system/openstack-neutron-plugin-openvswitch-agent.service
index 894c3a4..ade1473 100644
--- a/openstack/usr/lib/systemd/system/openstack-neutron-plugin-openvswitch-agent.service
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-plugin-openvswitch-agent.service
@@ -1,7 +1,8 @@
[Unit]
Description=Neutron OpenvSwitch Plugin Agent
-After=network-online.target openstack-neutron-setup.service
-Wants=network-online.target
+ConditionPathExists=/etc/neutron/neutron.conf
+After=network-online.target openstack-neutron-config-setup.service openstack-neutron-db-setup.service
+Wants=network-online.target openstack-neutron-config-setup.service
[Service]
Type=simple
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-server.service b/openstack/usr/lib/systemd/system/openstack-neutron-server.service
index 05dfb7a..3c0e1bd 100644
--- a/openstack/usr/lib/systemd/system/openstack-neutron-server.service
+++ b/openstack/usr/lib/systemd/system/openstack-neutron-server.service
@@ -1,7 +1,8 @@
[Unit]
Description=Neutron Api Server
-Wants=openstack-neutron-network-configuration-one-node.service network-online.target
-After=network-online.target openstack-neutron-setup.service openstack-neutron-network-configuration-one-node.service
+ConditionPathExists=/etc/neutron/neutron.conf
+Wants=openstack-neutron-network-configuration-one-node.service network-online.target openstack-neutron-config-setup.service
+After=openstack-neutron-network-configuration-one-node.service network-online.target openstack-neutron-config-setup.service openstack-neutron-db-setup.service
[Service]
Type=simple
diff --git a/openstack/usr/lib/systemd/system/openstack-neutron-setup.service b/openstack/usr/lib/systemd/system/openstack-neutron-setup.service
deleted file mode 100644
index 99213b6..0000000
--- a/openstack/usr/lib/systemd/system/openstack-neutron-setup.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Run neutron-setup Ansible scripts
-After=network-online.target openstack-keystone-setup.service postgres-server.service
-Wants=network-online.target
-
-[Service]
-ExecStart=/usr/bin/ansible-playbook -v -M /usr/share/ansible/ansible-openstack-modules -i /usr/share/openstack/hosts /usr/share/openstack/neutron.yml
-
-[Install]
-WantedBy=multi-user.target
diff --git a/openstack/usr/share/openstack/neutron-config.yml b/openstack/usr/share/openstack/neutron-config.yml
new file mode 100644
index 0000000..97f4c76
--- /dev/null
+++ b/openstack/usr/share/openstack/neutron-config.yml
@@ -0,0 +1,48 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/openstack/neutron.conf"
+ tasks:
+
+ - name: Create the neutron user.
+ user:
+ name: neutron
+ comment: Openstack Neutron Daemons
+ shell: /sbin/nologin
+ home: /var/lib/neutron
+
+ - name: Create the /var folders for neutron
+ file:
+ path: "{{ item }}"
+ state: directory
+ owner: neutron
+ group: neutron
+ with_items:
+ - /var/run/neutron
+ - /var/lock/neutron
+ - /var/log/neutron
+
+ - name: Get service tenant id needed in neutron.conf
+ shell: |
+ keystone \
+ --os-endpoint http://{{ CONTROLLER_HOST_ADDRESS|quote }}:35357/v2.0 \
+ --os-token {{ KEYSTONE_TEMPORARY_ADMIN_TOKEN|quote }} \
+ tenant-get service | grep id | tr -d " " | cut -d"|" -f3
+ register: tenant_service_id
+
+ - set_fact:
+ SERVICE_TENANT_ID: "{{ tenant_service_id.stdout }}"
+
+ - name: Create the directories needed for Neutron configuration files.
+ file:
+ path: /etc/{{ item }}
+ state: directory
+ with_lines:
+ - cd /usr/share/openstack && find neutron -type d
+
+ - name: Add configuration needed for neutron using templates
+ template:
+ src: /usr/share/openstack/{{ item }}
+ dest: /etc/{{ item }}
+ with_lines:
+ - cd /usr/share/openstack && find neutron -type f
diff --git a/openstack/usr/share/openstack/neutron-db.yml b/openstack/usr/share/openstack/neutron-db.yml
new file mode 100644
index 0000000..6234047
--- /dev/null
+++ b/openstack/usr/share/openstack/neutron-db.yml
@@ -0,0 +1,51 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/openstack/neutron.conf"
+ tasks:
+ - name: Create neutron service user in service tenatnt
+ keystone_user:
+ user: "{{ NEUTRON_SERVICE_USER }}"
+ password: "{{ NEUTRON_SERVICE_PASSWORD }}"
+ tenant: service
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Add admin role to neutron service user in service tenant
+ keystone_user:
+ role: admin
+ user: "{{ NEUTRON_SERVICE_USER }}"
+ tenant: service
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - keystone_service:
+ name: neutron
+ type: network
+ description: Openstack Compute Networking
+ publicurl: http://{{ CONTROLLER_HOST_ADDRESS }}:9696
+ internalurl: http://{{ CONTROLLER_HOST_ADDRESS }}:9696
+ adminurl: http://{{ CONTROLLER_HOST_ADDRESS }}:9696
+ region: regionOne
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Create postgresql user for neutron
+ postgresql_user:
+ name: "{{ NEUTRON_DB_USER }}"
+ password: "{{ NEUTRON_DB_PASSWORD }}"
+ sudo: yes
+ sudo_user: neutron
+
+ - name: Create database for neutron services
+ postgresql_db:
+ name: neutron
+ owner: "{{ NEUTRON_DB_USER }}"
+ sudo: yes
+ sudo_user: neutron
+
+ - name: Initiate neutron database
+ shell: |
+ neutron-db-manage \
+ --config-file /etc/neutron/neutron.conf \
+ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \
+ upgrade juno
+ sudo: yes
+ sudo_user: neutron
diff --git a/openstack/usr/share/openstack/neutron.yml b/openstack/usr/share/openstack/neutron.yml
deleted file mode 100644
index 7529a65..0000000
--- a/openstack/usr/share/openstack/neutron.yml
+++ /dev/null
@@ -1,109 +0,0 @@
----
-- hosts: localhost
- vars_files:
- - "/etc/openstack/neutron.conf"
- tasks:
-
- - name: Create the neutron user.
- user:
- name: neutron
- comment: Openstack Neutron Daemons
- shell: /sbin/nologin
- home: /var/lib/neutron
-
- - name: Create the /var folders for neutron
- file:
- path: "{{ item }}"
- state: directory
- owner: neutron
- group: neutron
- with_items:
- - /var/run/neutron
- - /var/lock/neutron
- - /var/log/neutron
-
- - name: Get service tenant id needed in neutron.conf
- shell: |
- keystone \
- --os-endpoint http://{{ CONTROLLER_HOST_ADDRESS|quote }}:35357/v2.0 \
- --os-token {{ KEYSTONE_TEMPORARY_ADMIN_TOKEN|quote }} \
- tenant-get service | grep id | tr -d " " | cut -d"|" -f3
- register: tenant_service_id
-
- - set_fact:
- SERVICE_TENANT_ID: "{{ tenant_service_id.stdout }}"
-
- - name: Create the directories needed for Neutron configuration files.
- file:
- path: /etc/{{ item }}
- state: directory
- with_lines:
- - cd /usr/share/openstack && find neutron -type d
-
- - name: Add configuration needed for neutron using templates
- template:
- src: /usr/share/openstack/{{ item }}
- dest: /etc/{{ item }}
- with_lines:
- - cd /usr/share/openstack && find neutron -type f
-
- - name: Create neutron service user in service tenatnt
- keystone_user:
- user: "{{ NEUTRON_SERVICE_USER }}"
- password: "{{ NEUTRON_SERVICE_PASSWORD }}"
- tenant: service
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - name: Add admin role to neutron service user in service tenant
- keystone_user:
- role: admin
- user: "{{ NEUTRON_SERVICE_USER }}"
- tenant: service
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - keystone_service:
- name: neutron
- type: network
- description: Openstack Compute Networking
- publicurl: http://{{ CONTROLLER_HOST_ADDRESS }}:9696
- internalurl: http://{{ CONTROLLER_HOST_ADDRESS }}:9696
- adminurl: http://{{ CONTROLLER_HOST_ADDRESS }}:9696
- region: regionOne
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - name: Create postgresql user for neutron
- postgresql_user:
- name: "{{ NEUTRON_DB_USER }}"
- password: "{{ NEUTRON_DB_PASSWORD }}"
- sudo: yes
- sudo_user: neutron
-
- - name: Create database for neutron services
- postgresql_db:
- name: neutron
- owner: "{{ NEUTRON_DB_USER }}"
- sudo: yes
- sudo_user: neutron
-
- - name: Initiate neutron database
- shell: |
- neutron-db-manage \
- --config-file /etc/neutron/neutron.conf \
- --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \
- upgrade juno
- sudo: yes
- sudo_user: neutron
-
- - name: Enable and start openstack-neutron services
- service:
- name: "{{ item }}"
- enabled: yes
- state: started
- with_items:
- - openstack-neutron-ovs-cleanup.service
- - openstack-neutron-server.service
- - openstack-neutron-dhcp-agent.service
- - openstack-neutron-l3-agent.service
- - openstack-neutron-metadata-agent.service
- - openstack-neutron-plugin-openvswitch-agent.service
-