Use rsync to copy layout configuration

Change-Id: I406bf0f5207fc9fe42a8c7ccccb3013fcee63969
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-12-19 17:52:07 -05:00
parent 346553884b
commit 07380285dd
4 changed files with 45 additions and 19 deletions

View File

@ -17,11 +17,11 @@ zuul_user_name: zuul
zuul_user_group: "{{ zuul_user_name }}"
zuul_user_home: "/var/lib/{{ zuul_user_name }}"
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_file_layout_dest: /etc/zuul/config/
zuul_file_layout_group: "{{ ansible_ssh_user }}"
zuul_file_layout_mode: "0755"
zuul_file_layout_owner: "{{ ansible_ssh_user }}"
zuul_file_layout_src: etc/zuul/config/
zuul_config_gearman_port: 4730
zuul_config_gearman_server: 127.0.0.1
@ -42,7 +42,7 @@ 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_yaml_dest }}"
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 }}"

View File

@ -59,12 +59,21 @@
src: "{{ zuul_file_server_logging_conf }}"
notify: Reload zuul-server
- 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 }}"
validate: 'zuul-server -c {{ zuul_template_zuul_conf_dest }} -t -l %s'
- name: Create layout config directory.
file:
dest: "{{ zuul_file_layout_dest }}"
group: "{{ zuul_file_layout_group }}"
mode: "{{ zuul_file_layout_mode }}"
owner: "{{ zuul_file_layout_owner }}"
state: directory
- name: Rsync layout configuration.
sudo: no
synchronize:
delete: yes
dest: "{{ zuul_file_layout_dest }}"
perms: yes
rsync_opts:
- "--chmod=Du=rwx,Dgo=rx"
src: "{{ zuul_file_layout_src }}"
notify: Reload zuul-server

View File

@ -64,9 +64,25 @@
- zuul_git_dest_stat.stat.exists
- zuul_git_dest_stat.stat.isdir
- name: Register /etc/zuul/layout.yaml
- name: Register /etc/zuul/config/
stat:
path: /etc/zuul/layout.yaml
path: /etc/zuul/config/
register: zuul_layout_stat
- name: Assert zuul_layout_stat tests.
assert:
that:
- zuul_layout_stat.stat.exists
- zuul_layout_stat.stat.isdir
# NOTE(pabelanger): This means we are hardcoded to the
# openstack-infra jenkins user in nodepool.
- zuul_layout_stat.stat.pw_name == 'jenkins'
- zuul_layout_stat.stat.gr_name == 'jenkins'
- zuul_layout_stat.stat.mode == '0755'
- name: Register /etc/zuul/config/layout.yaml
stat:
path: /etc/zuul/config/layout.yaml
register: zuul_layout_yaml_stat
- name: Assert zuul_layout_yaml_stat tests.
@ -74,9 +90,10 @@
that:
- 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'
# NOTE(pabelanger): This means we are hardcoded to the
# openstack-infra jenkins user in nodepool.
- zuul_layout_yaml_stat.stat.pw_name == 'jenkins'
- zuul_layout_yaml_stat.stat.gr_name == 'jenkins'
- name: Register /etc/init.d/zuul-merger
stat: