diff --git a/defaults/main.yaml b/defaults/main.yaml index 9985f84..821c1c6 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -17,8 +17,11 @@ zuul_user_name: zuul zuul_user_group: "{{ zuul_user_name }}" zuul_user_home: "/var/lib/{{ zuul_user_name }}" -zuul_project_config_dir: "" -zuul_project_config_dir_dest: /etc/zuul/config +zuul_file_layout_yaml_dest: /etc/zuul/layout.yaml +zuul_file_layout_yaml_group: "{{ zuul_user_name }}" +zuul_file_layout_yaml_mode: "0644" +zuul_file_layout_yaml_owner: "{{ zuul_user_group }}" +zuul_file_layout_yaml_src: etc/zuul/layout.yaml zuul_config_gearman_port: 4730 zuul_config_gearman_server: 127.0.0.1 @@ -38,7 +41,7 @@ zuul_config_merger_git_user_name: "" zuul_config_merger_log_config: /etc/zuul/merger-logging.conf zuul_config_merger_zuul_url: 127.0.0.1 -zuul_config_zuul_layout_config: "{{ zuul_project_config_dir_dest }}/layout.yaml" +zuul_config_zuul_layout_config: "{{ zuul_file_layout_yaml_dest }}" zuul_config_zuul_log_config: /etc/zuul/server-logging.conf zuul_config_zuul_state_dir: "{{ zuul_user_home }}" diff --git a/files/etc/zuul/layout.yaml b/files/etc/zuul/layout.yaml new file mode 100644 index 0000000..bce06e4 --- /dev/null +++ b/files/etc/zuul/layout.yaml @@ -0,0 +1,8 @@ +# This file is generated by Ansible +# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN +# +pipelines: [] + +jobs: [] + +projects: [] diff --git a/tasks/config.yaml b/tasks/config.yaml index 99eb3f9..79a05a8 100644 --- a/tasks/config.yaml +++ b/tasks/config.yaml @@ -59,24 +59,11 @@ src: "{{ zuul_file_server_logging_conf }}" notify: Reload zuul-server -- name: Create project config directory. - file: - group: "{{ ansible_ssh_user }}" - mode: 0775 - owner: "{{ ansible_ssh_user }}" - path: "{{ item }}" - state: directory - with_items: - - "{{ zuul_project_config_dir_dest }}" - notify: Reload zuul-server - -- name: Rsync project config directory. - sudo: no - synchronize: - dest: "{{ zuul_project_config_dir_dest }}" - perms: yes - rsync_opts: - - '--delete' - src: "{{ zuul_project_config_dir }}" - when: zuul_project_config_dir != "" +- name: Copy layout yaml file. + copy: + dest: "{{ zuul_file_layout_yaml_dest }}" + group: "{{ zuul_file_layout_yaml_group }}" + mode: "{{ zuul_file_layout_yaml_mode }}" + owner: "{{ zuul_file_layout_yaml_owner }}" + src: "{{ zuul_file_layout_yaml_src }}" notify: Reload zuul-server diff --git a/tests/test.yaml b/tests/test.yaml index 1bfd7aa..711ea28 100644 --- a/tests/test.yaml +++ b/tests/test.yaml @@ -64,26 +64,19 @@ - zuul_git_dest_stat.stat.exists - zuul_git_dest_stat.stat.isdir - - name: Register zuul_project_config_dir_dest_stat. + - name: Register /etc/zuul/layout.yaml stat: - path: /etc/zuul/config - register: zuul_project_config_dir_dest_stat + path: /etc/zuul/layout.yaml + register: zuul_layout_yaml_stat - - name: Assert zuul_project_config_dir_dest tests. + - name: Assert zuul_layout_yaml_stat tests. assert: that: - - zuul_project_config_dir_dest_stat.stat.exists - - zuul_project_config_dir_dest_stat.stat.isdir - # NOTE(pabelanger): This means we are hardcoded to the - # openstack-infra jenkins user in nodepool. - - zuul_project_config_dir_dest_stat.stat.pw_name == 'jenkins' - - zuul_project_config_dir_dest_stat.stat.gr_name == 'jenkins' - - zuul_project_config_dir_dest_stat.stat.mode == '0775' - - - name: Ensure /etc/zuul/config is empty. - shell: "ls -1 /etc/zuul/config | wc -l" - register: result - failed_when: result.stdout != "0" + - zuul_layout_yaml_stat.stat.exists + - zuul_layout_yaml_stat.stat.isreg + - zuul_layout_yaml_stat.stat.pw_name == 'zuul' + - zuul_layout_yaml_stat.stat.gr_name == 'zuul' + - zuul_layout_yaml_stat.stat.mode == '0644' - name: Register /etc/init.d/zuul-merger stat: