Stop templating configuration options

Simplify things by only passing the zuul.conf file, not a template.
If users need more dynamic options, they are free to template the file
first then use us to copy the file in place.

Change-Id: Ibd599b3ece707682eff9650a2244c0fb092f601c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-05-14 12:45:46 -04:00
parent 8cf5650809
commit 2063ed25a3
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
5 changed files with 89 additions and 76 deletions

View File

@ -23,36 +23,29 @@ zuul_file_layout_mode: "0755"
zuul_file_layout_owner: "{{ zuul_user_name }}"
zuul_file_layout_src: etc/zuul/config/
zuul_config_gearman_port: 4730
zuul_config_gearman_server: 127.0.0.1
zuul_file_gearman_logging_conf_dest: /etc/zuul/gearman-logging.conf
zuul_file_gearman_logging_conf_group: "{{ zuul_user_group }}"
zuul_file_gearman_logging_conf_mode: "0644"
zuul_file_gearman_logging_conf_owner: "{{ zuul_user_name }}"
zuul_file_gearman_logging_conf_src: etc/zuul/gearman-logging.conf
zuul_config_gearman_server_start: true
zuul_config_gearman_server_listen_address: 127.0.0.1
zuul_config_gearman_server_log_config: /etc/zuul/gearman-logging.conf
zuul_file_merger_logging_conf_dest: /etc/zuul/merger-logging.conf
zuul_file_merger_logging_conf_group: "{{ zuul_user_group }}"
zuul_file_merger_logging_conf_mode: "0644"
zuul_file_merger_logging_conf_owner: "{{ zuul_user_name }}"
zuul_file_merger_logging_conf_src: etc/zuul/merger-logging.conf
zuul_config_gerrit_port: 29418
zuul_config_gerrit_server: 127.0.0.1
zuul_config_gerrit_sshkey: "{{ zuul_user_home }}/.ssh/id_rsa"
zuul_config_gerrit_user: zuul
zuul_file_server_logging_conf_dest: /etc/zuul/server-logging.conf
zuul_file_server_logging_conf_group: "{{ zuul_user_group }}"
zuul_file_server_logging_conf_mode: "0644"
zuul_file_server_logging_conf_owner: "{{ zuul_user_name }}"
zuul_file_server_logging_conf_src: etc/zuul/server-logging.conf
zuul_config_merger_git_dir: "{{ zuul_user_home }}/git"
zuul_config_merger_git_user_email: ""
zuul_config_merger_git_user_name: ""
zuul_config_merger_log_config: /etc/zuul/merger-logging.conf
zuul_config_merger_pidfile: /var/run/zuul-merger/zuul-merger.pid
zuul_config_merger_zuul_url: 127.0.0.1
zuul_config_zuul_layout_config: "{{ zuul_file_layout_dest }}/layout.yaml"
zuul_config_zuul_log_config: /etc/zuul/server-logging.conf
zuul_config_zuul_pidfile: /var/run/zuul-server/zuul-server.pid
zuul_config_zuul_state_dir: "{{ zuul_user_home }}"
zuul_file_gearman_logging_conf: etc/zuul/gearman-logging.conf
zuul_file_merger_logging_conf: etc/zuul/merger-logging.conf
zuul_file_server_logging_conf: etc/zuul/server-logging.conf
zuul_template_zuul_conf_dest: /etc/zuul/zuul.conf
zuul_template_zuul_conf_src: etc/zuul/zuul.conf.j2
zuul_file_zuul_conf_dest: /etc/zuul/zuul.conf
zuul_file_zuul_conf_group: "{{ zuul_user_group }}"
zuul_file_zuul_conf_mode: "0644"
zuul_file_zuul_conf_owner: "{{ zuul_user_name }}"
zuul_file_zuul_conf_src: etc/zuul/zuul.conf
# tasks/install.yaml
zuul_git_dest: /opt/ansible-role-zuul/git/openstack-infra/zuul

29
files/etc/zuul/zuul.conf Normal file
View File

@ -0,0 +1,29 @@
# This file is generated by Ansible
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
[gearman]
port = 4730
server = 127.0.0.1
[gearman_server]
listen_address = 127.0.0.1
log_config = /etc/zuul/gearman-logging.conf
start = true
[gerrit]
port = 29418
server = 127.0.0.1
sshkey = /var/lib/zuul/.ssh/id_rsa
user = zuul
[zuul]
layout_config = /etc/zuul/config/layout.yaml
log_config = /etc/zuul/server-logging.conf
pidfile = /var/run/zuul-server/zuul-server.pid
state_dir = /var/lib/zuul
[merger]
git_dir = /var/lib/zuul/git
log_config = /etc/zuul/merger-logging.conf
pidfile = /var/run/zuul-merger/zuul-merger.pid
zuul_url = 127.0.0.1

View File

@ -23,34 +23,34 @@
- /etc/zuul
- /var/log/zuul
- name: Template zuul configuration file.
become: yes
template:
dest: "{{ zuul_template_zuul_conf_dest }}"
src: "{{ zuul_template_zuul_conf_src }}"
notify:
- Reload zuul-merger
- Reload zuul-server
- name: Copy gearman logging file.
become: yes
copy:
dest: "{{ zuul_config_gearman_server_log_config }}"
src: "{{ zuul_file_gearman_logging_conf }}"
dest: "{{ zuul_file_gearman_logging_conf_dest }}"
group: "{{ zuul_file_gearman_logging_conf_group }}"
mode: "{{ zuul_file_gearman_logging_conf_mode }}"
owner: "{{ zuul_file_gearman_logging_conf_owner }}"
src: "{{ zuul_file_gearman_logging_conf_src }}"
notify: Reload zuul-server
- name: Copy merger logging file.
become: yes
copy:
dest: "{{ zuul_config_merger_log_config }}"
src: "{{ zuul_file_merger_logging_conf }}"
dest: "{{ zuul_file_merger_logging_conf_dest }}"
group: "{{ zuul_file_merger_logging_conf_group }}"
mode: "{{ zuul_file_merger_logging_conf_mode }}"
owner: "{{ zuul_file_merger_logging_conf_owner }}"
src: "{{ zuul_file_merger_logging_conf_src }}"
notify: Reload zuul-merger
- name: Copy server logging file.
become: yes
copy:
dest: "{{ zuul_config_zuul_log_config }}"
src: "{{ zuul_file_server_logging_conf }}"
dest: "{{ zuul_file_server_logging_conf_dest }}"
group: "{{ zuul_file_server_logging_conf_group }}"
mode: "{{ zuul_file_server_logging_conf_mode }}"
owner: "{{ zuul_file_server_logging_conf_owner }}"
src: "{{ zuul_file_server_logging_conf_src }}"
notify: Reload zuul-server
- name: Copy layout configuration.
@ -62,3 +62,15 @@
owner: "{{ zuul_file_layout_owner }}"
src: "{{ zuul_file_layout_src }}"
notify: Reload zuul-server
- name: Copy zuul configuration.
become: yes
copy:
dest: "{{ zuul_file_zuul_conf_dest }}"
group: "{{ zuul_file_zuul_conf_group }}"
mode: "{{ zuul_file_zuul_conf_mode }}"
owner: "{{ zuul_file_zuul_conf_owner }}"
src: "{{ zuul_file_zuul_conf_src }}"
notify:
- Reload zuul-merger
- Reload zuul-server

View File

@ -1,34 +0,0 @@
[gearman]
port = {{ zuul_config_gearman_port }}
server = {{ zuul_config_gearman_server }}
[gearman_server]
listen_address = {{ zuul_config_gearman_server_listen_address }}
log_config = {{ zuul_config_gearman_server_log_config }}
start = {{ zuul_config_gearman_server_start }}
[gerrit]
port = {{ zuul_config_gerrit_port }}
server = {{ zuul_config_gerrit_server }}
sshkey = {{ zuul_config_gerrit_sshkey }}
user = {{ zuul_config_gerrit_user }}
[zuul]
layout_config = {{ zuul_config_zuul_layout_config }}
log_config = {{ zuul_config_zuul_log_config }}
pidfile = {{ zuul_config_zuul_pidfile }}
state_dir = {{ zuul_config_zuul_state_dir }}
[merger]
git_dir = {{ zuul_config_merger_git_dir }}
{% if zuul_config_merger_git_user_email != "" %}
git_user_email = {{ zuul_config_merger_git_user_email }}
{%endif %}
{% if zuul_config_merger_git_user_name != "" %}
git_user_name = {{ zuul_config_merger_git_user_name }}
{%endif %}
log_config = {{ zuul_config_merger_log_config }}
pidfile = {{ zuul_config_merger_pidfile }}
zuul_url = {{ zuul_config_merger_zuul_url }}
# {{ ansible_managed }}

View File

@ -91,6 +91,19 @@
- zuul_layout_yaml_stat.stat.pw_name == 'zuul'
- zuul_layout_yaml_stat.stat.gr_name == 'zuul'
- name: Register /etc/zuul/zuul.conf
stat:
path: /etc/zuul/zuul.conf
register: zuul_conf_stat
- name: Assert zuul_conf_stat tests.
assert:
that:
- zuul_conf_stat.stat.exists
- zuul_conf_stat.stat.isreg
- zuul_conf_stat.stat.pw_name == 'zuul'
- zuul_conf_stat.stat.gr_name == 'zuul'
- name: Register /etc/default/zuul
stat:
path: /etc/default/zuul