From 3ffc00940fdfddbef2c3bd4bc2298104ab606504 Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Tue, 2 Apr 2019 12:28:31 +0200 Subject: [PATCH] sync-devstack-data: new argument devstack_data_base_dir When the role is used by grenade, the data directory is shared among different devstack executions, and the base directory is different, for example: /opt/stack/data vs /opt/stack/{old,new}. The new devstack_data_base_dir parameter allows user to specify a base directory for the data/ directory which is unrelated to the devstack directory. The default value is devstack_base_dir, so the default behavior is unchanged. Change-Id: Ie69b7b51947cbf1a8b31d2701783de2fb56a2d33 --- roles/sync-devstack-data/README.rst | 7 +++++++ roles/sync-devstack-data/defaults/main.yaml | 1 + roles/sync-devstack-data/tasks/main.yaml | 12 ++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/roles/sync-devstack-data/README.rst b/roles/sync-devstack-data/README.rst index 500e8cccc4..388625c893 100644 --- a/roles/sync-devstack-data/README.rst +++ b/roles/sync-devstack-data/README.rst @@ -10,3 +10,10 @@ subnodes. :default: /opt/stack The devstack base directory. + +.. zuul:rolevar:: devstack_data_base_dir + :default: {{ devstack_base_dir }} + + The devstack base directory for data/. + Useful for example when multiple executions of devstack (i.e. grenade) + share the same data directory. diff --git a/roles/sync-devstack-data/defaults/main.yaml b/roles/sync-devstack-data/defaults/main.yaml index fea05c8146..6b5017b811 100644 --- a/roles/sync-devstack-data/defaults/main.yaml +++ b/roles/sync-devstack-data/defaults/main.yaml @@ -1 +1,2 @@ devstack_base_dir: /opt/stack +devstack_data_base_dir: "{{ devstack_base_dir }}" diff --git a/roles/sync-devstack-data/tasks/main.yaml b/roles/sync-devstack-data/tasks/main.yaml index 46000159d4..e62be87ccd 100644 --- a/roles/sync-devstack-data/tasks/main.yaml +++ b/roles/sync-devstack-data/tasks/main.yaml @@ -1,7 +1,7 @@ - name: Ensure the data folder exists become: true file: - path: "{{ devstack_base_dir }}/data" + path: "{{ devstack_data_base_dir }}/data" state: directory owner: stack group: stack @@ -11,7 +11,7 @@ - name: Ensure the CA folder exists become: true file: - path: "{{ devstack_base_dir }}/data/CA" + path: "{{ devstack_data_base_dir }}/data/CA" state: directory owner: stack group: stack @@ -25,8 +25,8 @@ dest: "{{ zuul.executor.work_root }}/{{ item | basename }}" mode: pull with_items: - - "{{ devstack_base_dir }}/data/ca-bundle.pem" - - "{{ devstack_base_dir }}/data/CA" + - "{{ devstack_data_base_dir }}/data/ca-bundle.pem" + - "{{ devstack_data_base_dir }}/data/CA" when: inventory_hostname == 'controller' - name: Push the CA certificate @@ -34,7 +34,7 @@ become_user: stack synchronize: src: "{{ zuul.executor.work_root }}/ca-bundle.pem" - dest: "{{ devstack_base_dir }}/data/ca-bundle.pem" + dest: "{{ devstack_data_base_dir }}/data/ca-bundle.pem" mode: push when: 'inventory_hostname in groups["subnode"]|default([])' @@ -43,6 +43,6 @@ become_user: stack synchronize: src: "{{ zuul.executor.work_root }}/CA/" - dest: "{{ devstack_base_dir }}/data/" + dest: "{{ devstack_data_base_dir }}/data/" mode: push when: 'inventory_hostname in groups["subnode"]|default([])'