mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Include ec2 inventory changes from https://github.com/ansible/ansible/pull/11293.
Include ec2.ini doc changes from https://github.com/ansible/ansible/pull/11236 and https://github.com/ansible/ansible/pull/11409.
This commit is contained in:
@@ -35,6 +35,9 @@ destination_variable = public_dns_name
|
|||||||
# private subnet, this should be set to 'private_ip_address', and Ansible must
|
# private subnet, this should be set to 'private_ip_address', and Ansible must
|
||||||
# be run from within EC2. The key of an EC2 tag may optionally be used; however
|
# be run from within EC2. The key of an EC2 tag may optionally be used; however
|
||||||
# the boto instance variables hold precedence in the event of a collision.
|
# the boto instance variables hold precedence in the event of a collision.
|
||||||
|
# WARNING: - instances that are in the private vpc, _without_ public ip address
|
||||||
|
# will not be listed in the inventory untill You set:
|
||||||
|
# vpc_destination_variable = 'private_ip_address'
|
||||||
vpc_destination_variable = ip_address
|
vpc_destination_variable = ip_address
|
||||||
|
|
||||||
# To tag instances on EC2 with the resource records that point to them from
|
# To tag instances on EC2 with the resource records that point to them from
|
||||||
@@ -88,10 +91,10 @@ group_by_rds_engine = True
|
|||||||
group_by_rds_parameter_group = True
|
group_by_rds_parameter_group = True
|
||||||
|
|
||||||
# If you only want to include hosts that match a certain regular expression
|
# If you only want to include hosts that match a certain regular expression
|
||||||
# pattern_include = stage-*
|
# pattern_include = staging-*
|
||||||
|
|
||||||
# If you want to exclude any hosts that match a certain regular expression
|
# If you want to exclude any hosts that match a certain regular expression
|
||||||
# pattern_exclude = stage-*
|
# pattern_exclude = staging-*
|
||||||
|
|
||||||
# Instance filters can be used to control which instances are retrieved for
|
# Instance filters can be used to control which instances are retrieved for
|
||||||
# inventory. For the full list of possible filters, please read the EC2 API
|
# inventory. For the full list of possible filters, please read the EC2 API
|
||||||
@@ -99,14 +102,14 @@ group_by_rds_parameter_group = True
|
|||||||
# Filters are key/value pairs separated by '=', to list multiple filters use
|
# Filters are key/value pairs separated by '=', to list multiple filters use
|
||||||
# a list separated by commas. See examples below.
|
# a list separated by commas. See examples below.
|
||||||
|
|
||||||
# Retrieve only instances with (key=value) env=stage tag
|
# Retrieve only instances with (key=value) env=staging tag
|
||||||
# instance_filters = tag:env=stage
|
# instance_filters = tag:env=staging
|
||||||
|
|
||||||
# Retrieve only instances with role=webservers OR role=dbservers tag
|
# Retrieve only instances with role=webservers OR role=dbservers tag
|
||||||
# instance_filters = tag:role=webservers,tag:role=dbservers
|
# instance_filters = tag:role=webservers,tag:role=dbservers
|
||||||
|
|
||||||
# Retrieve only t1.micro instances OR instances with tag env=stage
|
# Retrieve only t1.micro instances OR instances with tag env=staging
|
||||||
# instance_filters = instance-type=t1.micro,tag:env=stage
|
# instance_filters = instance-type=t1.micro,tag:env=staging
|
||||||
|
|
||||||
# You can use wildcards in filter values also. Below will list instances which
|
# You can use wildcards in filter values also. Below will list instances which
|
||||||
# tag Name value matches webservers1*
|
# tag Name value matches webservers1*
|
||||||
|
|||||||
@@ -520,7 +520,10 @@ class Ec2Inventory(object):
|
|||||||
# Inventory: Group by tag keys
|
# Inventory: Group by tag keys
|
||||||
if self.group_by_tag_keys:
|
if self.group_by_tag_keys:
|
||||||
for k, v in instance.tags.items():
|
for k, v in instance.tags.items():
|
||||||
key = self.to_safe("tag_" + k + "=" + v)
|
if v:
|
||||||
|
key = self.to_safe("tag_" + k + "=" + v)
|
||||||
|
else:
|
||||||
|
key = self.to_safe("tag_" + k)
|
||||||
self.push(self.inventory, key, dest)
|
self.push(self.inventory, key, dest)
|
||||||
if self.nested_groups:
|
if self.nested_groups:
|
||||||
self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k))
|
self.push_group(self.inventory, 'tags', self.to_safe("tag_" + k))
|
||||||
|
|||||||
Reference in New Issue
Block a user