summaryrefslogtreecommitdiff
path: root/openstack/usr/share/openstack
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-03-27 15:22:25 +0000
committerRichard Ipsum <richardipsum@fastmail.co.uk>2015-04-10 20:17:46 +0100
commit2114780ff5b4d6de2dc74e9fa1dc34baa74270c5 (patch)
tree3747efdf9cc369161efe8a183fd7ee93555aeac5 /openstack/usr/share/openstack
parentc67183cb206a96f642bb54b7e5b9aa278876293d (diff)
downloaddefinitions-2114780ff5b4d6de2dc74e9fa1dc34baa74270c5.tar.gz
openvswitch: Move setup scripts to Ansible.
Also change systemd units and configure extension to match this change
Diffstat (limited to 'openstack/usr/share/openstack')
-rw-r--r--openstack/usr/share/openstack/openvswitch-setup44
-rw-r--r--openstack/usr/share/openstack/openvswitch.yml40
2 files changed, 40 insertions, 44 deletions
diff --git a/openstack/usr/share/openstack/openvswitch-setup b/openstack/usr/share/openstack/openvswitch-setup
deleted file mode 100644
index a5db7d21..00000000
--- a/openstack/usr/share/openstack/openvswitch-setup
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2014 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
-
-if [ -f /var/openstack/openvswitch-setup ]; then
- exit 0
-fi
-
-# Create the openvswitch required folders
-mkdir -p /usr/local/etc/openvswitch
-mkdir -p /usr/local/var/run/openvswitch
-
-# Define openvswitch files
-# Example (default values)
-#openvswitch_database=/usr/local/etc/openvswitch/conf.db
-#openvswitch_pidfile=/usr/local/var/run/openvswitch/ovsdb-server.pid
-#openvswitch_logfile=/usr/local/var/run/openvswitch/ovsdb-server.log
-openvswitch_database=/usr/local/etc/openvswitch/conf.db
-openvswitch_pidfile=/usr/local/var/run/openvswitch/ovsdb-server.pid
-openvswitch_logfile=/usr/local/var/run/openvswitch/ovsdb-server.log
-
-# Create openvswitch database
-ovsdb-tool create $openvswitch_database /usr/share/openvswitch/vswitch.ovsschema
-
-install -D -m 644 /proc/self/fd/0 <<'EOF' /var/openstack/openvswitch-setup
-Openvswitch setup: success
-EOF
-
-exit 0
diff --git a/openstack/usr/share/openstack/openvswitch.yml b/openstack/usr/share/openstack/openvswitch.yml
new file mode 100644
index 00000000..dd6eeac0
--- /dev/null
+++ b/openstack/usr/share/openstack/openvswitch.yml
@@ -0,0 +1,40 @@
+#!/bin/sh
+---
+- hosts: localhost
+ tasks:
+
+ - name: Create openvswitch directories
+ file: path={{ item }} state=directory
+ with_items:
+ - /usr/local/etc/openvswitch
+ - /usr/local/var/run/openvswitch
+
+ - shell: >
+ ovsdb-tool create /usr/local/etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema
+ creates=/usr/local/etc/openvswitch/conf.db
+
+ # We enable the openvswitch-db-server in a different task to identify
+ # the first time we run this script by identifying when we enable the
+ # unit.
+ #
+ # We need to identify this to initialise the database.
+ - name: Enable openvswitch database service
+ service: name={{ item }} enabled=yes
+ with_items:
+ - openvswitch-db-server.service
+ register: openvswitch_db_enable
+
+ - name: Start openvswitch database service
+ service: name={{ item }} state=started
+ with_items:
+ - openvswitch-db-server.service
+
+ - name: initialise openvswitch-db
+ shell: ovs-vsctl --no-wait init
+ when: openvswitch_db_enable|changed
+
+ - name: Enable and start openstack-keystone service
+ service: name={{ item }} enabled=yes state=started
+ with_items:
+ - openvswitch.service
+ - openstack-neutron-setup.service