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