mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
At its most basic, this is nothing more than an array or hash lookup, but when used in conjunction with map, it is very useful. For example, while constructing an "ssh-keyscan …" command to update known_hosts on all hosts in a group, one can get a list of IP addresses with: groups['x']|map('extract', hostvars, 'ec2_ip_address')|list This returns hostvars[a].ec2_ip_address, hostvars[b].ec2_ip_address, and so on. You can even specify an array of keys for a recursive lookup, and mix string and integer keys depending on what you're looking up: ['localhost']|map('extract', hostvars, ['vars','group_names',0])|first == hostvars['localhost']['vars']['group_names'][0] == 'ungrouped' Includes documentation and tests. |
||
---|---|---|
.. | ||
modules | ||
ansible_ssh_changes_note.rst | ||
become.rst | ||
common_return_values.rst | ||
community.rst | ||
developing.rst | ||
developing_api.rst | ||
developing_inventory.rst | ||
developing_modules.rst | ||
developing_plugins.rst | ||
developing_test_pr.rst | ||
faq.rst | ||
galaxy.rst | ||
glossary.rst | ||
guide_aws.rst | ||
guide_cloudstack.rst | ||
guide_gce.rst | ||
guide_rax.rst | ||
guide_rolling_upgrade.rst | ||
guide_vagrant.rst | ||
guides.rst | ||
index.rst | ||
intro.rst | ||
intro_adhoc.rst | ||
intro_bsd.rst | ||
intro_configuration.rst | ||
intro_dynamic_inventory.rst | ||
intro_getting_started.rst | ||
intro_installation.rst | ||
intro_inventory.rst | ||
intro_patterns.rst | ||
intro_windows.rst | ||
modules.rst | ||
modules_core.rst | ||
modules_extra.rst | ||
modules_intro.rst | ||
playbooks.rst | ||
playbooks_acceleration.rst | ||
playbooks_async.rst | ||
playbooks_best_practices.rst | ||
playbooks_blocks.rst | ||
playbooks_checkmode.rst | ||
playbooks_conditionals.rst | ||
playbooks_delegation.rst | ||
playbooks_environment.rst | ||
playbooks_error_handling.rst | ||
playbooks_filters.rst | ||
playbooks_filters_ipaddr.rst | ||
playbooks_intro.rst | ||
playbooks_lookups.rst | ||
playbooks_loops.rst | ||
playbooks_prompts.rst | ||
playbooks_roles.rst | ||
playbooks_special_topics.rst | ||
playbooks_startnstep.rst | ||
playbooks_strategies.rst | ||
playbooks_tags.rst | ||
playbooks_variables.rst | ||
playbooks_vault.rst | ||
quickstart.rst | ||
test_strategies.rst | ||
tower.rst | ||
YAMLSyntax.rst |