Of this blob
TASK: [context_deploy | debug ]
***********************************************
ok: [myserver] => {
"msg": "1 {'msg': 'All items completed', 'changed': False, 'results':
[{'invocation': {'module_name': u'include_vars', 'module_complex_args': {},
'module_args':
u'/Users/jespermarkenstam/tmp/master/automation.ansible/group_vars/context_def'},
'item': 'def', 'ansible_facts': {'application_gavdeploy_list':
[{'endpoint': 'http://localhost:8080/def-service-bot/health', 'group':
'wildfly', 'dest': '/opt/wildfly/standalone/deployments', 'version': u'1',
'owner': 'wildfly', 'type': 'war', 'groupId': 'com.xyz.cpp.def.service',
'artifactId': 'def-bot-service'}, {'endpoint':
'http://localhost:8080/def-service-bot/health', 'group': 'wildfly', 'dest':
'/opt/wildfly/standalone/deployments', 'version': u'1', 'owner': 'wildfly',
'type': 'war', 'groupId': 'com.xyz.cpp.def.service', 'artifactId':
'def-bot-service2'}]}}, {'invocation': {'module_name': u'include_vars',
'module_complex_args': {}, 'module_args':
u'/Users/jespermarkenstam/tmp/master/automation.ansible/group_vars/context_abc'},
'item': 'abc', 'ansible_facts': {'application_gavdeploy_list':
[{'endpoint': 'http://localhost:8080/abc-write-dot/health', 'group':
'wildfly', 'dest': '/opt/wildfly/standalone/deployments', 'version': u'1',
'owner': 'wildfly', 'type': 'war', 'groupId': 'com.xyz.cpp.abc.write',
'artifactId': 'abc-dot-write'}]}}]}"
}
I want to extract all the groupId, artifactId, version, endpoint, and so on.
so far, I register the output from several lists into one dynamic variable
"contexts"
- include_vars: "{{ playbook_dir }}/group_vars/context_{{ item }}"
register: contexts
with_items:
- "{{ wildfly_context }}"
# this produces the blob above
- debug:
msg: "1 {{ contexts }}"
I want to loop over it, but I appear to have nested loops, and this is
where I struggle - here the first loop over results.
- debug:
msg: "4 {% for gav in contexts['results'] %}{{ gav.ansible_facts }} {%
endfor %}"
How can I loop over ansible_facts': {'application_gavdeploy_list' to get
all my artifactId's for example?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/da6df323-939f-4675-9217-5675a18f70ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.