Skip to content

Instantly share code, notes, and snippets.

@hemna
Created February 26, 2018 15:38
Show Gist options
  • Save hemna/9b448e2644a09c8436af306a294f37f3 to your computer and use it in GitHub Desktop.
Save hemna/9b448e2644a09c8436af306a294f37f3 to your computer and use it in GitHub Desktop.
diff --git a/roles/CND-VOL/tasks/configure.yml b/roles/CND-VOL/tasks/configure.yml
index c0bdce6..37a3159 100644
--- a/roles/CND-VOL/tasks/configure.yml
+++ b/roles/CND-VOL/tasks/configure.yml
@@ -16,40 +16,7 @@
#
---
-- name: CND-VOL | configure | obtain cinder volume version from package install
- set_fact:
- cinder_volume_version: >-
- {{ ardana_notify_cinder_volume_venv_install.version }}
- when: not (ardana_notify_cinder_volume_venv_install is not defined)
-
-- name: CND-VOL | configure | obtain cinder volume version from {{ cinder_venv_root }}/
- shell: >
- readlink -f {{ cinder_venv_root }}/cinder-volume |
- sed 's#{{ cinder_venv_root }}/cinder-volume-##g'
- register: cinder_volume_link_result
- when: ardana_notify_cinder_volume_venv_install is not defined
-
-- name: CND-VOL | configure | set volume version fact from link
- set_fact:
- cinder_volume_version: "{{ cinder_volume_link_result.stdout }}"
- when: ardana_notify_cinder_volume_venv_install is not defined
-
-- name: CND-VOL | configure | set versioned cinder_volume_conf_dir fact
- set_fact:
- cinder_volume_conf_dir: >-
- {{ 'cinder-volume' | config_dir(cinder_volume_version) }}
- cinder_volume_venv_share_dir: >-
- {{ 'cinder-volume' | share_dir(cinder_volume_version) }}/cinder
-
-# Trying to render conf_dir in the include line results in infinite recursion.
-# Since cinder_conf_dir may have already been set via CND-BCK role, which
-# includes this task, we don't want to override with cinder_volume_conf_dir.
-- name: CND-VOL | configure | Generate conf_dir path for common include
- set_fact:
- conf_dir: "{{ cinder_conf_dir | default(cinder_volume_conf_dir) }}"
-- include: ../../_CND-CMN/tasks/configure.yml
- vars:
- cinder_conf_dir: "{{ conf_dir }}"
+- include: ./_cinder_volume_vars.yml
- name: CND-VOL | configure | Generate {{ cinder_volume_conf_dir }}/volume.conf
template:
diff --git a/roles/CND-VOL/tasks/start.yml b/roles/CND-VOL/tasks/start.yml
index ab0af22..37545b4 100644
--- a/roles/CND-VOL/tasks/start.yml
+++ b/roles/CND-VOL/tasks/start.yml
@@ -21,6 +21,9 @@
- include: ./_activate.yml
+# test to see if rendered cinder.conf has enabled_backends set
+- include: ./_test_backends_enabled.yml
+
- name: CND-VOL | start | Start tgt service
service:
name: "{{ cinder_tgt_service_name }}"
@@ -39,14 +42,16 @@
cinder_volume_restarted_result is not defined) or
(ardana_notify_cinder_volume_venv_install is defined and
ardana_notify_cinder_volume_venv_install.changed and
- cinder_volume_restarted_result is not defined))
+ cinder_volume_restarted_result is not defined)) and
+ (_cinder_backends_enabled | bool)
register: cinder_volume_restarted_result
- name: CND-VOL | start | Ensure cinder-volume service is started
service:
name: cinder-volume
state: started
- when: (_cinder_volume_running_here | bool)
+ when: (_cinder_volume_running_here | bool) and
+ (_cinder_backends_enabled | bool)
# This creates the local cinder fact file. On the initial deploy the value
# written to the file will be the default index value of 0. This file is only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment