ansible-collections / amazon.aws

Ansible Collection for Amazon AWS
GNU General Public License v3.0
279 stars 322 forks source link

Clarify usage of ansible_ec2_network_interfaces_macs_mac* facts #586

Open danwashusen opened 2 years ago

danwashusen commented 2 years ago

Summary

The docs don't really mention how the various ansible_ec2_network_interfaces_macs_mac* facts work (e.g. the 'mac' part is expanded). To use the facts one needs build a variable name dynamically which requires a bit of trial and error to use...

A few simple examples would go a long way:

{{ lookup('vars', 'ansible_ec2_network_interfaces_macs_' + (ansible_ec2_mac | replace(':', '_')) + '_subnet_ipv4_cidr_block') }}

Issue Type

Documentation Report

Component Name

amazon.aws.ec2_metadata_facts

Ansible Version

$ ansible --version

ansible [core 2.12.0]
  config file = None
  configured module search path = ['/home/danwas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /home/danwas/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.5 (default, May 11 2021, 08:20:37) [GCC 10.3.0]
  jinja version = 3.0.3
  libyaml = True

Collection Versions

$ ansible-galaxy collection list
Collection        Version
----------------- -------
amazon.aws        2.0.0
ansible.posix     1.3.0
community.aws     2.0.0
community.docker  1.10.0
community.general 3.7.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

Ubuntu 20.04

Additional Information

No response

Code of Conduct

jillr commented 2 years ago

Hi @danwashusen More docs would definitely be great, would you be interested in opening a PR to add some examples of things that you've found useful?