zuul-jobs/roles/validate-host/tasks/main.yaml
Albin Vass 94e69147a7 Replace occurences of '/' in nodename to something more path friendly
Inventory hostnames like "abc/123" is valid in both ansible and zuul
but this role breaks since it uses it as part of a path. This sanitizes
the hostname from "abc/123" to "abc_123".

Change-Id: Ic89d595b6f004b5ca4805f1af8387e8ba56564aa
2020-03-16 11:27:10 +01:00

42 lines
1.3 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: Sanitize hostname
set_fact:
validate_host_hostname_sanitized: "{{ validate_host_hostname | replace('/', '_') }}"
- name: Write out all ansible variables/facts known for each host
delegate_to: localhost
template:
dest: "{{ zuul_info_dir }}/host-info.{{ validate_host_hostname_sanitized }}.yaml"
src: templates/host-info.j2
- name: zuul_debug_info block
block:
- 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.{{ validate_host_hostname_sanitized }}.txt"
src: templates/zuul-info.j2
when: ansible_python_version is version('2.7', '>=')