From 3cdd445d8b5b3fb76af67cc175eab5a4d107e0e7 Mon Sep 17 00:00:00 2001
From: SamYaple <sam@yaple.net>
Date: Fri, 26 Feb 2016 15:53:42 +0000
Subject: [PATCH] Neutron ugprade play

Since openvswitch is handled in the kernel, it really is as simple as
upgrade the container since the container only has userspace tools in
it.

Partially-Implements: blueprint upgrade-kolla
Implements: blueprint upgrade-neutron
Change-Id: Iec57c67a1ccba8f48b752fe832cd714bcc658af0
---
 ansible/roles/neutron/tasks/bootstrap.yml     | 19 +---------------
 .../roles/neutron/tasks/bootstrap_service.yml | 19 ++++++++++++++++
 ansible/roles/neutron/tasks/upgrade.yml       | 22 +++++++++++++++++++
 3 files changed, 42 insertions(+), 18 deletions(-)
 create mode 100644 ansible/roles/neutron/tasks/bootstrap_service.yml

diff --git a/ansible/roles/neutron/tasks/bootstrap.yml b/ansible/roles/neutron/tasks/bootstrap.yml
index 45821fa681..30c9006bde 100644
--- a/ansible/roles/neutron/tasks/bootstrap.yml
+++ b/ansible/roles/neutron/tasks/bootstrap.yml
@@ -35,22 +35,5 @@
   run_once: True
   delegate_to: "{{ groups['neutron-server'][0] }}"
 
-- name: Running Neutron bootstrap container
-  kolla_docker:
-    action: "start_container"
-    common_options: "{{ docker_common_options }}"
-    detach: False
-    environment:
-      KOLLA_BOOTSTRAP:
-      KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
-    image: "{{ neutron_server_image_full }}"
-    labels:
-      BOOTSTRAP:
-    name: "bootstrap_neutron"
-    restart_policy: "never"
-    volumes:
-      - "{{ node_config_directory }}/neutron-server/:{{ container_config_directory }}/:ro"
-      - "kolla_logs:/var/log/kolla/"
-  run_once: True
-  delegate_to: "{{ groups['neutron-server'][0] }}"
+- include: bootstrap_service.yml
   when: database_created
diff --git a/ansible/roles/neutron/tasks/bootstrap_service.yml b/ansible/roles/neutron/tasks/bootstrap_service.yml
new file mode 100644
index 0000000000..6eb6c92180
--- /dev/null
+++ b/ansible/roles/neutron/tasks/bootstrap_service.yml
@@ -0,0 +1,19 @@
+---
+- name: Running Neutron bootstrap container
+  kolla_docker:
+    action: "start_container"
+    common_options: "{{ docker_common_options }}"
+    detach: False
+    environment:
+      KOLLA_BOOTSTRAP:
+      KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
+    image: "{{ neutron_server_image_full }}"
+    labels:
+      BOOTSTRAP:
+    name: "bootstrap_neutron"
+    restart_policy: "never"
+    volumes:
+      - "{{ node_config_directory }}/neutron-server/:{{ container_config_directory }}/:ro"
+      - "kolla_logs:/var/log/kolla/"
+  run_once: True
+  delegate_to: "{{ groups['neutron-server'][0] }}"
diff --git a/ansible/roles/neutron/tasks/upgrade.yml b/ansible/roles/neutron/tasks/upgrade.yml
index ed97d539c0..08f57269df 100644
--- a/ansible/roles/neutron/tasks/upgrade.yml
+++ b/ansible/roles/neutron/tasks/upgrade.yml
@@ -1 +1,23 @@
 ---
+- include: config.yml
+  when: inventory_hostname in groups['compute']
+        or inventory_hostname in groups['neutron-dhcp-agent']
+        or inventory_hostname in groups['neutron-l3-agent']
+        or inventory_hostname in groups['neutron-metadata-agent']
+        or inventory_hostname in groups['neutron-server']
+
+- include: config-neutron-fake.yml
+  when:
+    - inventory_hostname in groups['compute']
+    - enable_nova_fake | bool
+
+- include: bootstrap_service.yml
+  when: inventory_hostname in groups['neutron-server']
+
+- include: start.yml
+  serial: "%30"
+  when: inventory_hostname in groups['compute']
+        or inventory_hostname in groups['neutron-dhcp-agent']
+        or inventory_hostname in groups['neutron-l3-agent']
+        or inventory_hostname in groups['neutron-metadata-agent']
+        or inventory_hostname in groups['neutron-server']