Browse code

Stage openstack config files

Stage config files from openstack and all projects used by the
devstack run.

Change-Id: I99f1bc71856b0da7fc5b438d13d4f508d2341e44

Andrea Frittoli (andreaf) authored on 2017/12/15 22:55:50
Showing 4 changed files
... ...
@@ -20,6 +20,7 @@
20 20
   roles:
21 21
     - export-devstack-journal
22 22
     - apache-logs-conf
23
+    - devstack-project-conf
23 24
     - role: stage-output
24 25
       zuul_copy_output:
25 26
         { '{{ devstack_conf_dir }}/local.conf': 'logs',
... ...
@@ -32,6 +33,7 @@
32 32
           '{{ stage_dir }}/verify_tempest_conf.log': 'logs',
33 33
           '{{ stage_dir }}/apache': 'logs',
34 34
           '{{ stage_dir }}/apache_config': 'logs',
35
+          '{{ stage_dir }}/etc': 'logs',
35 36
           '/var/log/rabbitmq': 'logs',
36 37
           '/var/log/postgresql': 'logs',
37 38
           '/var/log/mysql.err': 'logs',
38 39
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+Prepare OpenStack project configurations for staging
1
+
2
+Prepare all relevant config files for staging.
3
+This is helpful to avoid staging the entire /etc.
4
+
5
+**Role Variables**
6
+
7
+.. zuul:rolevar:: stage_dir
8
+   :default: {{ ansible_user_dir }}
9
+
10
+   The base stage directory.
0 11
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+stage_dir: "{{ ansible_user_dir }}"
0 1
new file mode 100644
... ...
@@ -0,0 +1,24 @@
0
+- name: Ensure {{ stage_dir }}/etc exists
1
+  file:
2
+    path: "{{ stage_dir }}/etc"
3
+    state: directory
4
+
5
+- name: Check which projects have a config folder
6
+  stat:
7
+    path: "/etc/{{ item.value.short_name }}"
8
+  with_dict: "{{ zuul.projects }}"
9
+  register: project_configs
10
+
11
+- name: Copy configuration files
12
+  command: cp -pRL {{ item.stat.path }} {{ stage_dir }}/etc/{{ item.item.value.short_name }}
13
+  when: item.stat.exists
14
+  with_items: "{{ project_configs.results }}"
15
+
16
+- name: Check if openstack has a config folder
17
+  stat:
18
+    path: "/etc/openstack"
19
+  register: openstack_configs
20
+
21
+- name: Copy configuration files
22
+  command: cp -pRL /etc/openstack {{ stage_dir }}/etc/
23
+  when: openstack_configs.stat.exists