zuul-jobs/roles/emit-job-header/tasks/main.yaml
Sorin Sbarnea 8a5bc42bb9 Improve job and node information banner
Adds information that is can be key regarding the outcome of the job:
* distribution name
* distribution version

Change-Id: I8362ef2f0a89de4c318f13c874b6f083a4f1699f
2020-03-30 10:47:24 +01:00

39 lines
1.5 KiB
YAML

# We don't want this to run for every host, it should only run once.
- run_once: yes
block:
- name: Setup log path fact
include_role:
name: set-zuul-log-path-fact
- name: Print job information
debug:
msg: |
# Job Information
Ansible Version: {{ ansible_version['full'] }}
Job: {{ zuul.job }}
Pipeline: {{ zuul.pipeline }}
Executor: {{ zuul.executor.hostname }}
{% if zuul.change_url is defined %}
Triggered by: {{ zuul.change_url }}
{% endif %}
{% if zuul_log_url is defined and zuul_log_path is defined %}
Log URL (when completed): {{ zuul_log_url }}/{{ zuul_log_path }}/
{% endif %}
{% if zuul.event_id is defined %}
Event ID: {{ zuul.event_id }}
{% endif %}
- name: Print node information
debug:
msg: |
# Node Information
Hostname: {{ hostvars[item]['ansible_hostname']|default('unknown') }}
Distro: {{ hostvars[item]['ansible_distribution'] | default('unknown') }} {{ hostvars[item]['ansible_distribution_version'] | default('unknown') }}
Provider: {{ hostvars[item]['nodepool']['provider'] }}
Label: {{ hostvars[item]['nodepool']['label'] }}
{% if hostvars[item]['nodepool']['interface_ip'] is defined %}
Interface IP: {{ hostvars[item]['nodepool']['interface_ip'] }}
{% endif %}
loop: "{{ query('inventory_hostnames', 'all,!localhost') }}"
ignore_errors: yes