AC-1134 Updated rax/ec2 inventory scripts from ansible. Added ability to filter groups/hosts by regular expression and exclude empty groups, so that Tower can exclude RAX/EC2 instance ID groups and EC2 RDS hosts/groups.

This commit is contained in:
Chris Church
2014-04-08 23:50:57 -04:00
parent 59dc2a2cb8
commit 1283a78e09
6 changed files with 268 additions and 110 deletions

View File

@@ -323,6 +323,20 @@ RAX_REGION_CHOICES = [
('HKG', 'Hong Kong'),
]
# Inventory variable name/values for determining if host is active/enabled.
RAX_ENABLED_VAR = 'rax_status'
RAX_ENABLED_VALUE = 'ACTIVE'
# Inventory variable name containing unique instance ID.
RAX_INSTANCE_ID_VAR = 'rax_id'
# Filter for allowed group/host names when importing inventory from Rackspace.
# By default, filter group of one created for each instance and exclude all
# groups without children, hosts and variables.
RAX_GROUP_FILTER = r'^(?!instance-.+).+$'
RAX_HOST_FILTER = r'^.+$'
RAX_EXCLUDE_EMPTY_GROUPS = True
# AWS does not appear to provide pretty region names via any API, so store the
# list of names here. The available region IDs will be pulled from boto.
# http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region
@@ -343,6 +357,20 @@ EC2_REGIONS_BLACKLIST = [
'cn-north-1',
]
# Inventory variable name/values for determining if host is active/enabled.
EC2_ENABLED_VAR = 'ec2_state'
EC2_ENABLED_VALUE = 'running'
# Inventory variable name containing unique instance ID.
EC2_INSTANCE_ID_VAR = 'ec2_id'
# Filter for allowed group/host names when importing inventory from EC2.
# By default, filter group of one created for each instance, filter all RDS
# hosts, and exclude all groups without children, hosts and variables.
EC2_GROUP_FILTER = r'^(?!i-[a-f0-9]{8,}).+$'
EC2_HOST_FILTER = r'^.+(?<!rds\.amazonaws\.com)$'
EC2_EXCLUDE_EMPTY_GROUPS = True
# Defaults for enabling/disabling activity stream.
ACTIVITY_STREAM_ENABLED = True
ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC = False