I’m trying to create a report when we do our updates via yum (rhel 7) and dnf (rhel 8). I register the output in variables called yum_rhel7 and yum _rhel8. Here’s my j2 file:
Yum/DNF Update Report
{{ now(false, ‘%m/%d/%Y %I:%M:%S’) }}
I’m trying to create a report when we do our updates via yum (rhel 7) and dnf (rhel 8). I register the output in variables called yum_rhel7 and yum _rhel8. Here’s my j2 file:
Yum/DNF Update Report
{{ now(false, ‘%m/%d/%Y %I:%M:%S’) }}
I'm trying to create a report when we do our updates via yum (rhel 7) and dnf (rhel 8). I register the output in variables called yum_rhel7 and yum _rhel8. Here's my j2 file:
Yum/DNF Update Report
{{ now(false, '%m/%d/%Y %I:%M:%S') }}
---
{% for i in play_hosts | sort %}
{% if {{ hostvars[i]['ansible_distribution_major_version'] == '7' }} %}
{% if {{ hostvars[i]['yum_rhel7']['skipped'] is not defined }} %}
Host: {{ i }}
Yum Result: {{ hostvars[i]['yum_rhel7']['results'] }}
{% endif %}
---
{% endfor %}
No curly braces in conditions, e.g. use
{% if hostvars[i]['ansible_distribution_major_version'] == '7' %}
Also
{% if 'skipped' not in hostvars[i]['yum_rhel7'] %}
is probably more correct.
Regards
Racke