Skip to content

Commit

Permalink
Add full path to the awx_ec2 inv example (#1378) (#1388)
Browse files Browse the repository at this point in the history
[PR #1378/83d68c16 backport][stable-5] Add full path to the awx_ec2 inv example

This is a backport of PR #1378 as merged into main (83d68c1).
SUMMARY

The current example does not work, since it uses the default namespace and collection names.
This fixes the problem and allows anyone who installs the collection to use it outside of the collection scope.

ISSUE TYPE


Docs Pull Request

COMPONENT NAME


inventory: aws_ec2

Reviewed-by: Mark Chappell
  • Loading branch information
patchback[bot] authored Feb 24, 2023
1 parent 0d02487 commit 2ac00de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/20230220-inventory_docs_ec2_aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- inventory:aws_ec2 - update docs. Add full path to the awx_ec2 inv example and update description to add a file name example.
14 changes: 7 additions & 7 deletions plugins/inventory/aws_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- amazon.aws.aws_credentials
description:
- Get inventory hosts from Amazon Web Services EC2.
- Uses a YAML configuration file that ends with C(aws_ec2.{yml|yaml}).
- "The inventory file is a YAML configuration file and must end with C(aws_ec2.{yml|yaml}). Example: C(my_inventory.aws_ec2.yml)."
notes:
- If no credentials are provided and the control node has an associated IAM instance profile then the
role will be used for authentication.
Expand Down Expand Up @@ -147,12 +147,12 @@
EXAMPLES = '''
# Minimal example using environment vars or instance role credentials
# Fetch all hosts in us-east-1, the hostname is the public DNS if it exists, otherwise the private IP address
plugin: aws_ec2
plugin: amazon.aws.aws_ec2
regions:
- us-east-1
# Example using filters, ignoring permission errors, and specifying the hostname precedence
plugin: aws_ec2
plugin: amazon.aws.aws_ec2
# The values for profile, access key, secret key and token can be hardcoded like:
boto_profile: aws_profile
# or you could use Jinja as:
Expand Down Expand Up @@ -189,7 +189,7 @@
allow_duplicated_hosts: False
# Example using constructed features to create groups and set ansible_host
plugin: aws_ec2
plugin: amazon.aws.aws_ec2
regions:
- us-east-1
- us-west-1
Expand Down Expand Up @@ -225,7 +225,7 @@
ansible_host: private_ip_address
# Example using include_filters and exclude_filters to compose the inventory.
plugin: aws_ec2
plugin: amazon.aws.aws_ec2
regions:
- us-east-1
- us-west-1
Expand All @@ -239,7 +239,7 @@
- 'my_first_tag'
# Example using groups to assign the running hosts to a group based on vpc_id
plugin: aws_ec2
plugin: amazon.aws.aws_ec2
boto_profile: aws_profile
# Populate inventory with instances in these regions
regions:
Expand All @@ -255,7 +255,7 @@
groups:
libvpc: vpc_id == 'vpc-####'
# Define prefix and suffix for host variables coming from AWS.
plugin: aws_ec2
plugin: amazon.aws.aws_ec2
regions:
- us-east-1
hostvars_prefix: 'aws_'
Expand Down

0 comments on commit 2ac00de

Please sign in to comment.