diff --git a/defaults/main.yaml b/defaults/main.yaml index 21713be..bc7c6be 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -64,6 +64,9 @@ zuul_install_method: git zuul_pip_version: # tasks/service.yaml +zuul_file_zuul_service_config_group: root +zuul_file_zuul_service_config_owner: root + zuul_file_zuul_merger_service_group: root zuul_file_zuul_merger_service_owner: root diff --git a/files/etc/default/zuul b/files/etc/default/zuul new file mode 100644 index 0000000..602ac8e --- /dev/null +++ b/files/etc/default/zuul @@ -0,0 +1,3 @@ +# This file is generated by Ansible +# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN +# diff --git a/files/etc/sysconfig/zuul b/files/etc/sysconfig/zuul new file mode 100644 index 0000000..602ac8e --- /dev/null +++ b/files/etc/sysconfig/zuul @@ -0,0 +1,3 @@ +# This file is generated by Ansible +# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN +# diff --git a/files/zuul.sysconfig b/files/zuul.sysconfig deleted file mode 100644 index e69de29..0000000 diff --git a/tasks/service.yaml b/tasks/service.yaml index 6225100..7a3c296 100644 --- a/tasks/service.yaml +++ b/tasks/service.yaml @@ -12,6 +12,21 @@ # License for the specific language governing permissions and limitations # under the License. --- +- name: Define zuul_file_zuul_service_config_dest. + set_fact: + zuul_file_zuul_service_config_dest: "{{ __zuul_file_zuul_service_config_dest }}" + when: zuul_file_zuul_service_config_dest is not defined + +- name: Define zuul_file_zuul_service_config_mode. + set_fact: + zuul_file_zuul_service_config_mode: "{{ __zuul_file_zuul_service_config_mode }}" + when: zuul_file_zuul_service_config_mode is not defined + +- name: Define zuul_file_zuul_service_config_src. + set_fact: + zuul_file_zuul_service_config_src: "{{ __zuul_file_zuul_service_config_src }}" + when: zuul_file_zuul_service_config_src is not defined + - name: Define zuul_file_zuul_merger_service_dest. set_fact: zuul_file_zuul_merger_service_dest: "{{ __zuul_file_zuul_merger_service_dest }}" @@ -42,6 +57,14 @@ zuul_file_zuul_server_service_src: "{{ __zuul_file_zuul_server_service_src }}" when: zuul_file_zuul_server_service_src is not defined +- name: Copy zuul service config into place. + copy: + dest: "{{ zuul_file_zuul_service_config_dest }}" + group: "{{ zuul_file_zuul_service_config_group }}" + mode: "{{ zuul_file_zuul_service_config_mode }}" + owner: "{{ zuul_file_zuul_service_config_owner }}" + src: "{{ zuul_file_zuul_service_config_src }}" + - name: Copy zuul-merger service into place. copy: dest: "{{ zuul_file_zuul_merger_service_dest }}" @@ -58,9 +81,6 @@ owner: "{{ zuul_file_zuul_server_service_owner }}" src: "{{ zuul_file_zuul_server_service_src }}" -- include: service/redhat.yaml - when: ansible_os_family == 'RedHat' - - name: Enable zuul-merger service. service: enabled: "{{ zuul_service_zuul_merger_enabled }}" diff --git a/tasks/service/redhat.yaml b/tasks/service/redhat.yaml deleted file mode 100644 index 989e7c7..0000000 --- a/tasks/service/redhat.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2015 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. ---- -- name: Copy sysconfig file into place. - copy: - dest: /etc/sysconfig/zuul - src: ../../files/zuul.sysconfig diff --git a/tests/test.yaml b/tests/test.yaml index 5a78148..25fe8cf 100644 --- a/tests/test.yaml +++ b/tests/test.yaml @@ -95,6 +95,22 @@ - zuul_layout_yaml_stat.stat.pw_name == 'jenkins' - zuul_layout_yaml_stat.stat.gr_name == 'jenkins' + - name: Register /etc/default/zuul + stat: + path: /etc/default/zuul + register: debian_zuul_service_config_stat + when: ansible_os_family == 'Debian' + + - name: Assert debian_zuul_service_config_stat tests. + assert: + that: + - debian_zuul_service_config_stat.stat.exists + - debian_zuul_service_config_stat.stat.isreg + - debian_zuul_service_config_stat.stat.pw_name == 'root' + - debian_zuul_service_config_stat.stat.gr_name == 'root' + - debian_zuul_service_config_stat.stat.mode == '0644' + when: ansible_os_family == 'Debian' + - name: Register /etc/init.d/zuul-merger stat: path: /etc/init.d/zuul-merger @@ -127,6 +143,22 @@ - debian_zuul_server_service_stat.stat.mode == '0755' when: ansible_os_family == 'Debian' + - name: Register /etc/sysconfig/zuul + stat: + path: /etc/sysconfig/zuul + register: redhat_zuul_service_config_stat + when: ansible_os_family == 'RedHat' + + - name: Assert redhat_zuul_service_config_stat tests. + assert: + that: + - redhat_zuul_service_config_stat.stat.exists + - redhat_zuul_service_config_stat.stat.isreg + - redhat_zuul_service_config_stat.stat.pw_name == 'root' + - redhat_zuul_service_config_stat.stat.gr_name == 'root' + - redhat_zuul_service_config_stat.stat.mode == '0644' + when: ansible_os_family == 'RedHat' + - name: Register /etc/systemd/system/zuul-merger.service stat: path: /etc/systemd/system/zuul-merger.service diff --git a/vars/Debian.yaml b/vars/Debian.yaml index 9af6f82..bdb54b2 100644 --- a/vars/Debian.yaml +++ b/vars/Debian.yaml @@ -17,6 +17,10 @@ __zuul_build_depends: - python-dev - python-pip +__zuul_file_zuul_service_config_dest: /etc/default/zuul +__zuul_file_zuul_service_config_mode: "0644" +__zuul_file_zuul_service_config_src: etc/default/zuul + __zuul_file_zuul_merger_service_dest: /etc/init.d/zuul-merger __zuul_file_zuul_merger_service_mode: "0755" __zuul_file_zuul_merger_service_src: etc/init.d/zuul-merger diff --git a/vars/RedHat.yaml b/vars/RedHat.yaml index 31cc0ed..aa6b9f3 100644 --- a/vars/RedHat.yaml +++ b/vars/RedHat.yaml @@ -19,6 +19,10 @@ __zuul_build_depends: - python-devel - python-pip +__zuul_file_zuul_service_config_dest: /etc/sysconfig/zuul +__zuul_file_zuul_service_config_mode: "0644" +__zuul_file_zuul_service_config_src: etc/sysconfig/zuul + __zuul_file_zuul_merger_service_dest: /etc/systemd/system/zuul-merger.service __zuul_file_zuul_merger_service_mode: "0644" __zuul_file_zuul_merger_service_src: etc/systemd/system/zuul-merger.service