Remove the use of vars and hostvars wherever possible.
`vars` operates inconsistently in different combinations of Ansible (full/base/core) and Python versions. Variables are now instead explicitly loaded under a subkey, which also removes the need for filtering and makes access more explicit and semantic.
This commit is contained in:
@@ -30,7 +30,7 @@ ansible-playbook playbooks/install_demo.yml -e @choose_demo.yml
|
||||
|
||||
# Demo Repository
|
||||
|
||||
This repository currently holds {{hostvars[inventory_hostname].items()|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined')|sort(attribute='1.name')|count}} demos.
|
||||
This repository currently holds {{job_template_definitions.items()|sort(attribute='1.name')|count}} demos.
|
||||
|
||||
## Infrastructure Demos
|
||||
<table>
|
||||
@@ -42,7 +42,7 @@ This repository currently holds {{hostvars[inventory_hostname].items()|rejectatt
|
||||
<th>Video Walkthrough</th>
|
||||
<th>Workshop Types</th>
|
||||
</tr>
|
||||
{% for key, value in hostvars[inventory_hostname].items()|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined')|selectattr('1.category', 'match', 'infrastructure$')|sort(attribute='1.name') %}
|
||||
{% for key, value in job_template_definitions.items()|selectattr('1.category', 'match', 'infrastructure$')|sort(attribute='1.name') %}
|
||||
<tr>
|
||||
<td>{% if value.readme is defined%}<a href="{{ value.readme}}">{{value.name}}</a>{% else %}{{value.name}}{% endif %}</td>
|
||||
<td>{{value.author}}</td>
|
||||
@@ -65,7 +65,7 @@ This repository currently holds {{hostvars[inventory_hostname].items()|rejectatt
|
||||
<th>Video Walkthrough</th>
|
||||
<th>Workshop Types</th>
|
||||
</tr>
|
||||
{% for key, value in hostvars[inventory_hostname].items()|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined')|selectattr('1.category', 'match', 'network$')|sort(attribute='1.name') %} <tr>
|
||||
{% for key, value in job_template_definitions.items()|selectattr('1.category', 'match', 'network$')|sort(attribute='1.name') %} <tr>
|
||||
<td>{{ value.name }}</td>
|
||||
<td>{{ value.author }}</td>
|
||||
<td><pre>demo: {{key }}</pre></td>
|
||||
@@ -87,7 +87,7 @@ This repository currently holds {{hostvars[inventory_hostname].items()|rejectatt
|
||||
<th>Video Walkthrough</th>
|
||||
<th>Workshop Types</th>
|
||||
</tr>
|
||||
{% for key, value in hostvars[inventory_hostname].items()|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined')|selectattr('1.category', 'match', 'security$')|sort(attribute='1.name') %} <tr>
|
||||
{% for key, value in job_template_definitions.items()|selectattr('1.category', 'match', 'security$')|sort(attribute='1.name') %} <tr>
|
||||
<td>{{ value.name }}</td>
|
||||
<td>{{ value.author }}</td>
|
||||
<td><pre>demo: {{ key }}</pre></td>
|
||||
@@ -109,7 +109,7 @@ This repository currently holds {{hostvars[inventory_hostname].items()|rejectatt
|
||||
<th>Video Walkthrough</th>
|
||||
<th>Workshop Types</th>
|
||||
</tr>
|
||||
{% for key, value in hostvars[inventory_hostname].items()|rejectattr('0', 'match', 'ansible_')|selectattr('1.name', 'defined')|selectattr('1.category', 'match', 'developer$')|sort(attribute='1.name') %} <tr>
|
||||
{% for key, value in job_template_definitions.items()|selectattr('1.category', 'match', 'developer$')|sort(attribute='1.name') %} <tr>
|
||||
<td>{{ value.name }}</td>
|
||||
<td>{{ value.author }}</td>
|
||||
<td><pre>demo: {{ key }}</pre></td>
|
||||
|
||||
Reference in New Issue
Block a user