zuul-jobs/roles/validate-host/tasks/main.yaml
Monty Taylor f3e89a488c
Make validate-host read from site-variables
Change the default parameters to the role to be zuul site variables.
Because of variable precedence, having these not be site variables means
someone could override them in a job. Since one of the actions is to
read and log the contents of a file, we likely don't want to give people
the ability to do that with an arbitrary file.

The traceroute host isn't as important to be a site variable, but it's
still not actually something that jobs should override - it's a feature
of the deployment.

Both variables work if they are not set, so deployers should still be
able to use this role without defining site-variables. But it should be
made clear to them that if they want those features they really should
define the locations in a site-variable and not in a normal job
variable.

configure-mirror similarly allows in-job override, but maybe that's ok
for now and leaving the site-variable value as a default is fine?

Finally, add a new zuul_site_image_manifest_files list, so that we can
specify more than one file to read. Set the defaults of it to be the
files that the dib nodepool elements emit. We'll also look in to pushing
those manifest files up a level into dib so that expecting nodepool
nodes to have them is even more reasonable.

Change-Id: I632a32fdfac4bfe57eb269ac8e183fb8df34d48f
2017-09-07 11:18:36 -05:00

40 lines
1.1 KiB
YAML

- name: Define zuul_info_dir fact
set_fact:
zuul_info_dir: "{{ zuul.executor.log_root }}/zuul-info"
- name: Ensure Zuul Ansible directory exists
delegate_to: localhost
run_once: true
file:
path: "{{ zuul_info_dir }}"
state: directory
- name: Collect information about the host
setup:
register: setupinfo
- name: Write out all ansible variables/facts known for each host
delegate_to: localhost
template:
dest: "{{ zuul_info_dir }}/host-info.{{ inventory_hostname }}.yaml"
src: templates/host-info.j2
- name: Collect information about zuul worker
zuul_debug_info:
image_manifest: "{{ zuul_site_image_manifest|default(omit) }}"
image_manifest_files: "{{ zuul_site_image_manifest_files|default(omit) }}"
traceroute_host: "{{ zuul_site_traceroute_host|default(omit) }}"
register: zdi
- name: Write out all zuul information for each host
delegate_to: localhost
template:
dest: "{{ zuul_info_dir }}/zuul-info.{{ inventory_hostname }}.txt"
src: templates/zuul-info.j2
- name: Copy ansible inventory to logs dir
delegate_to: localhost
copy:
src: "{{ inventory_file }}"
dest: "{{ zuul_info_dir }}"