From 5a9872a9b90c06cddbbd4a18b16e715e3db9a939 Mon Sep 17 00:00:00 2001 From: "Andrea Frittoli (andreaf)" Date: Fri, 15 Dec 2017 13:55:50 +0000 Subject: [PATCH] Stage openstack config files Stage config files from openstack and all projects used by the devstack run. Change-Id: I99f1bc71856b0da7fc5b438d13d4f508d2341e44 --- playbooks/post.yaml | 2 ++ roles/devstack-project-conf/README.rst | 11 +++++++++ .../devstack-project-conf/defaults/main.yaml | 1 + roles/devstack-project-conf/tasks/main.yaml | 24 +++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 roles/devstack-project-conf/README.rst create mode 100644 roles/devstack-project-conf/defaults/main.yaml create mode 100644 roles/devstack-project-conf/tasks/main.yaml diff --git a/playbooks/post.yaml b/playbooks/post.yaml index ee8a87820e..36023a625a 100644 --- a/playbooks/post.yaml +++ b/playbooks/post.yaml @@ -20,6 +20,7 @@ roles: - export-devstack-journal - apache-logs-conf + - devstack-project-conf - role: stage-output zuul_copy_output: { '{{ devstack_conf_dir }}/local.conf': 'logs', @@ -32,6 +33,7 @@ '{{ stage_dir }}/verify_tempest_conf.log': 'logs', '{{ stage_dir }}/apache': 'logs', '{{ stage_dir }}/apache_config': 'logs', + '{{ stage_dir }}/etc': 'logs', '/var/log/rabbitmq': 'logs', '/var/log/postgresql': 'logs', '/var/log/mysql.err': 'logs', diff --git a/roles/devstack-project-conf/README.rst b/roles/devstack-project-conf/README.rst new file mode 100644 index 0000000000..3f2d4c9697 --- /dev/null +++ b/roles/devstack-project-conf/README.rst @@ -0,0 +1,11 @@ +Prepare OpenStack project configurations for staging + +Prepare all relevant config files for staging. +This is helpful to avoid staging the entire /etc. + +**Role Variables** + +.. zuul:rolevar:: stage_dir + :default: {{ ansible_user_dir }} + + The base stage directory. diff --git a/roles/devstack-project-conf/defaults/main.yaml b/roles/devstack-project-conf/defaults/main.yaml new file mode 100644 index 0000000000..f8fb8deac9 --- /dev/null +++ b/roles/devstack-project-conf/defaults/main.yaml @@ -0,0 +1 @@ +stage_dir: "{{ ansible_user_dir }}" diff --git a/roles/devstack-project-conf/tasks/main.yaml b/roles/devstack-project-conf/tasks/main.yaml new file mode 100644 index 0000000000..9c6e06bea9 --- /dev/null +++ b/roles/devstack-project-conf/tasks/main.yaml @@ -0,0 +1,24 @@ +- name: Ensure {{ stage_dir }}/etc exists + file: + path: "{{ stage_dir }}/etc" + state: directory + +- name: Check which projects have a config folder + stat: + path: "/etc/{{ item.value.short_name }}" + with_dict: "{{ zuul.projects }}" + register: project_configs + +- name: Copy configuration files + command: cp -pRL {{ item.stat.path }} {{ stage_dir }}/etc/{{ item.item.value.short_name }} + when: item.stat.exists + with_items: "{{ project_configs.results }}" + +- name: Check if openstack has a config folder + stat: + path: "/etc/openstack" + register: openstack_configs + +- name: Copy configuration files + command: cp -pRL /etc/openstack {{ stage_dir }}/etc/ + when: openstack_configs.stat.exists