zuul-jobs/roles/test-emit-job-header/tasks/main.yaml
Paul Belanger d428fdf8c7
Add nodepool info to test-emit-job-header
We'd like to also display the node information at run time, which is
helpful if we ever need to debug / hold a running job.

Change-Id: Idcd4370e09639fe81b701bde10510d5828b283cc
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-08-10 11:57:22 -04:00

34 lines
1.2 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 %}
- name: Print node information
debug:
msg: |
# Node Information
Hostname: {{ hostvars[item]['ansible_hostname'] }}
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') }}"