summaryrefslogtreecommitdiff
path: root/openstack
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2015-04-14 13:00:50 +0000
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-04-16 16:30:44 +0000
commit0aa33ca0596dcb6a388c1228707f69112be4c052 (patch)
tree3066ce90087afc759c99ab4bb78036bfe9b4f4da /openstack
parent1146b222d5782cc771952328b7b3f989af743d0c (diff)
downloaddefinitions-0aa33ca0596dcb6a388c1228707f69112be4c052.tar.gz
OpenStack: Split neutron config up into MANAGER, CONTROLLER and AGENT
This adds NEUTRON_ENABLE_{MANAGER,CONTROLLER,AGENT} to determine which parts should be run on a node, so a network node has MANAGER enabled, but doesn't need CONTROLLER or AGENT, since those will be run on the controller and compute nodes respectively. This works by the configuration extension selectively enabling systemd units, with config-setup always being run, and db-setup run on the controller node. Rather than having the enable logic in 3 distinct setup services, their dependencies have been augmented to run after appropriate setup services if they are enabled, and to not run if their configuration hasn't been created. Change-Id: I7625074c94acfb49fc68660440609b0fe9c0052d
Diffstat (limited to 'openstack')
-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
13 files changed, 147 insertions, 133 deletions
diff --git a/openstack/manifest b/openstack/manifest
index 072c647b..8911abbf 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 00000000..46e1b585
--- /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 00000000..4b30e78a
--- /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 34a682b6..cd9ed9fe 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 bd514aa1..1a6b5928 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 22bbf675..c96fa3a2 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 544531ed..386f50dd 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 894c3a45..ade14733 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 05dfb7aa..3c0e1bda 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 99213b6a..00000000
--- 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 00000000..97f4c76e
--- /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 00000000..62340477
--- /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 7529a656..00000000
--- 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
-