Skip to content

Instantly share code, notes, and snippets.

@cloudnull
Created August 25, 2014 23:15
Show Gist options
  • Save cloudnull/24c740b0e99ea5066ad2 to your computer and use it in GitHub Desktop.
Save cloudnull/24c740b0e99ea5066ad2 to your computer and use it in GitHub Desktop.
# Append any options in config to the host_vars of a container
container_vars = host_options.get('container_vars')
if isinstance(container_vars, dict):
for _keys, _vars in container_vars.items():
# Copy the options dictionary for manipulation
options = _vars.copy()
for _k, _v in options.items():
limit = None
# If a limit is set use the limit string as a filter
# for the container name and see if it matches.
if 'limit_container_types' in _v:
limit = options.pop(
'limit_container_types', None
)
if limit is None or limit in container:
hdata[_keys] = options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment