Merge "Make validate-host read from site-variables"

This commit is contained in:
Zuul 2017-09-08 22:57:45 +00:00 committed by Gerrit Code Review
commit 579d9f2202
8 changed files with 70 additions and 15 deletions

View File

@ -3,6 +3,7 @@ An ansible role to configure services to use mirrors.
**Role Variables** **Role Variables**
.. zuul:rolevar:: mirror_fqdn .. zuul:rolevar:: mirror_fqdn
:default: {{ zuul_site_mirror_fqdn }}
The base host for mirror servers. The base host for mirror servers.

View File

@ -1,2 +1,3 @@
mirror_fqdn: "{{ zuul_site_mirror_fqdn|default(omit) }}"
pypi_mirror: "http://{{ mirror_fqdn }}/pypi/simple" pypi_mirror: "http://{{ mirror_fqdn }}/pypi/simple"
wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}" wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"

View File

@ -1 +1,32 @@
Log information about the remote build host Log information about the build node
**Role Variables**
.. zuul:rolevar:: zuul_traceroute_host
:default: {{ zuul_site_traceroute_host }}
If defined, a host to run a traceroute against to verify build node
network connectivity.
**DEPRECATED** being replaced by zuul_site versions.
.. zuul:rolevar:: zuul_image_manifest
:default: {{ zuul_site_image_manifest|default('/etc/dib-builddate.txt') }}
A file expected to be on the filesystem of the build node to read if it
exists and log. The default value comes from a site-variable called
``zuul_site_image_manifest``, but if that is not set
``/etc/dib-builddate.txt`` is used, which is written to nodes by
diskimage-builder in the ``nodepool-base`` element.
**DEPRECATED** being replaced by zuul_site versions.
.. zuul:rolevar:: zuul_site_traceroute_host
If defined, a host to run a traceroute against to verify build node
network connectivity.
.. zuul:rolevar:: zuul_site_image_manifest_files
:default: ['/etc/dib-builddate.txt', '/etc/image-hostname.txt']
A list of files to read from the filesystem of the build node and
whose contents will be logged. The default files are files written
to nodes by diskimage-builder.

View File

@ -0,0 +1,3 @@
zuul_site_traceroute_host: "{{ zuul_traceroute_host|default(omit) }}"
zuul_site_image_manifest: "{{ validate_host_default_image_manifest_files }}"
zuul_site_image_manifest_files: "{{ zuul_site_image_manifest_files|default(validate_host_default_image_manifest_files) }}"

View File

@ -42,16 +42,26 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
image_manifest=dict(required=False, type='str'), image_manifest=dict(required=False, type='str'),
image_manifest_files=dict(required=False, type='list'),
traceroute_host=dict(required=False, type='str'), traceroute_host=dict(required=False, type='str'),
) )
) )
image_manifest = module.params['image_manifest'] image_manifest = module.params['image_manifest']
traceroute_host = module.params['traceroute_host'] traceroute_host = module.params['traceroute_host']
ret = {'image_manifest': None, 'traceroute': None} image_manifest_files = module.params['image_manifest_files']
if not image_manifest_files and image_manifest:
image_manifest_files = [image_manifest]
ret = {'image_manifest_files': [], 'traceroute': None}
if image_manifest and os.path.exists(image_manifest): for image_manifest in image_manifest_files:
ret['image_manifest'] = open(image_manifest, 'r').read() if image_manifest and os.path.exists(image_manifest):
ret['image_manifest_files'].append({
'filename': image_manifest,
# Do this in python cause it's easier than in jinja2
'underline': len(image_manifest) * '-',
'content': open(image_manifest, 'r').read(),
})
if traceroute_host: if traceroute_host:
passed = False passed = False
try: try:

View File

@ -21,8 +21,9 @@
- name: Collect information about zuul worker - name: Collect information about zuul worker
zuul_debug_info: zuul_debug_info:
image_manifest: "{{ zuul_image_manifest|default(omit) }}" image_manifest: "{{ zuul_site_image_manifest|default(omit) }}"
traceroute_host: "{{ zuul_traceroute_host|default(omit) }}" image_manifest_files: "{{ zuul_site_image_manifest_files|default(omit) }}"
traceroute_host: "{{ zuul_site_traceroute_host|default(omit) }}"
register: zdi register: zdi
- name: Write out all zuul information for each host - name: Write out all zuul information for each host

View File

@ -1,46 +1,51 @@
{% if 'image_manifest' in zdi %} {% if zdi.image_manifest_files %}
Image Information Image Information
================= =================
{{ zdi.image_manifest }}
{% endif %}
{% for item in zdi.image_manifest_files %}
{{ item.filename }}
{{ item.underline }}
{{ item.content }}
{% endfor %}
{% endif %}
{% if 'uname' in zdi %} {% if 'uname' in zdi %}
Host & kernel Host & kernel
============= =============
{{ zdi.uname }} {{ zdi.uname }}
{% endif %}
{% endif %}
{% if 'network_interfaces' in zdi %} {% if 'network_interfaces' in zdi %}
Network interface addresses Network interface addresses
=========================== ===========================
{{ zdi.network_interfaces }} {{ zdi.network_interfaces }}
{% endif %}
{% endif %}
{% if 'network_routing_v4' in zdi %} {% if 'network_routing_v4' in zdi %}
Network routing tables v4 Network routing tables v4
========================= =========================
{{ zdi.network_routing_v4 }} {{ zdi.network_routing_v4 }}
{% endif %}
{% endif %}
{% if 'network_routing_v6' in zdi %} {% if 'network_routing_v6' in zdi %}
Network routing tables v6 Network routing tables v6
========================= =========================
{{ zdi.network_routing_v6 }} {{ zdi.network_routing_v6 }}
{% endif %}
{% endif %}
{% if 'network_neighbors' in zdi %} {% if 'network_neighbors' in zdi %}
Network neighbors Network neighbors
================= =================
{{ zdi.network_neighbors }} {{ zdi.network_neighbors }}
{% endif %}
{% endif %}
{% if 'traceroute_v4' in zdi %} {% if 'traceroute_v4' in zdi %}
Route to Known Host v4 Route to Known Host v4
====================== ======================
Known Host: {{ zuul_traceroute_host }} Known Host: {{ zuul_traceroute_host }}
{{ zdi.traceroute_v4 }} {{ zdi.traceroute_v4 }}
{% endif %}
{% endif %}
{% if 'traceroute_v6' in zdi %} {% if 'traceroute_v6' in zdi %}
Route to Known Host v6 Route to Known Host v6
====================== ======================

View File

@ -0,0 +1,3 @@
validate_host_default_image_manifest_files:
- /etc/dib-builddate.txt
- /etc/image-hostname.txt