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
This commit is contained in:
Albin Vass 2020-03-16 11:07:10 +01:00
parent ffe0738f60
commit 94e69147a7
3 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,4 @@
zuul_site_image_manifest_files:
- /etc/dib-builddate.txt
- /etc/image-hostname.txt
validate_host_hostname: "{{ inventory_hostname }}"

View File

@ -13,10 +13,14 @@
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.{{ inventory_hostname }}.yaml"
dest: "{{ zuul_info_dir }}/host-info.{{ validate_host_hostname_sanitized }}.yaml"
src: templates/host-info.j2
- name: zuul_debug_info block
@ -31,7 +35,7 @@
- name: Write out all zuul information for each host
delegate_to: localhost
template:
dest: "{{ zuul_info_dir }}/zuul-info.{{ inventory_hostname }}.txt"
dest: "{{ zuul_info_dir }}/zuul-info.{{ validate_host_hostname_sanitized }}.txt"
src: templates/zuul-info.j2
when: ansible_python_version is version('2.7', '>=')

View File

@ -11,3 +11,4 @@
roles:
- role: validate-host
zuul_site_traceroute_host: files.openstack.org
validate_host_hostname: "abc/123"