original_docstring: Append all containers to physical (logical) groups based on host types.
  
      :param inventory: ``dict``  Living dictionary of inventory
  
      :param container_type: ``str``  Type of container
      :param assignment: ``str`` Name of container component target
      :param host_type: ``str``  Name of the host type
      :param type_and_name: ``str`` Combined name of host and container name
      
docstring: Append all containers to physical (logical) groups based on host types.
docstring_tokens: Append all containers to physical ( logical ) groups based on host types .
code: def _append_to_host_groups(inventory, container_type, assignment, host_type,
                             type_and_name, host_options):
      """Append all containers to physical (logical) groups based on host types.
  
      :param inventory: ``dict``  Living dictionary of inventory
  
      :param container_type: ``str``  Type of container
      :param assignment: ``str`` Name of container component target
      :param host_type: ``str``  Name of the host type
      :param type_and_name: ``str`` Combined name of host and container name
      """
      physical_group_type = '%s_all' % container_type.split('_')[0]
      if physical_group_type not in inventory:
          inventory[physical_group_type] = {'hosts': []}
  
      iph = inventory[physical_group_type]['hosts']
      iah = inventory[assignment]['hosts']
      for hname, hdata in inventory['_meta']['hostvars'].iteritems():
          if 'container_types' in hdata or 'container_name' in hdata:
              if 'container_name' not in hdata:
                  container = hdata['container_name'] = hname
              else:
                  container = hdata['container_name']
  
              component = hdata.get('component')
              if container.startswith(host_type):
                  if 'physical_host' not in hdata:
                      hdata['physical_host'] = host_type
  
                  if container.startswith('%s-' % type_and_name):
                      append_if(array=iah, item=container)
                  elif hdata.get('is_metal') is True:
                      if component == assignment:
                          append_if(array=iah, item=container)
  
                  if container.startswith('%s-' % type_and_name):
                      append_if(array=iph, item=container)
                  elif hdata.get('is_metal') is True:
                      if container.startswith(host_type):
                          append_if(array=iph, item=container)
  
                  # 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
                          if isinstance(_vars, dict):
                              options = _vars.copy()
                          else:
                              options = _vars
  
                          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 options:
                              limit = options.pop(
                                  'limit_container_types', None
                              )
  
                          if limit is None or limit in container:
                              hdata[_keys] = options
code_tokens: def _append_to_host_groups ( inventory , container_type , assignment , host_type , type_and_name , host_options ) : physical_group_type = '%s_all' % container_type . split ( '_' ) [ 0 ] if physical_group_type not in inventory : inventory [ physical_group_type ] = { 'hosts' : [ ] } iph = inventory [ physical_group_type ] [ 'hosts' ] iah = inventory [ assignment ] [ 'hosts' ] for hname , hdata in inventory [ '_meta' ] [ 'hostvars' ] . iteritems ( ) : if 'container_types' in hdata or 'container_name' in hdata : if 'container_name' not in hdata : container = hdata [ 'container_name' ] = hname else : container = hdata [ 'container_name' ] component = hdata . get ( 'component' ) if container . startswith ( host_type ) : if 'physical_host' not in hdata : hdata [ 'physical_host' ] = host_type if container . startswith ( '%s-' % type_and_name ) : append_if ( array = iah , item = container ) elif hdata . get ( 'is_metal' ) is True : if component == assignment : append_if ( array = iah , item = container ) if container . startswith ( '%s-' % type_and_name ) : append_if ( array = iph , item = container ) elif hdata . get ( 'is_metal' ) is True : if container . startswith ( host_type ) : append_if ( array = iph , item = container ) container_vars = host_options . get ( 'container_vars' ) if isinstance ( container_vars , dict ) : for _keys , _vars in container_vars . items ( ) : if isinstance ( _vars , dict ) : options = _vars . copy ( ) else : options = _vars limit = None if 'limit_container_types' in options : limit = options . pop ( 'limit_container_types' , None ) if limit is None or limit in container : hdata [ _keys ] = options
short_docstring: Append all containers to physical (logical) groups based on host types.
short_docstring_tokens: Append all containers to physical ( logical ) groups based on host types .
comment: """Append all containers to physical (logical) groups based on host types.
  
      :param inventory: ``dict``  Living dictionary of inventory
  
      :param container_type: ``str``  Type of container
      :param assignment: ``str`` Name of container component target
      :param host_type: ``str``  Name of the host type
      :param type_and_name: ``str`` Combined name of host and container name
      """$SEP$# Append any options in config to the host_vars of a container$SEP$# Copy the options dictionary for manipulation$SEP$# If a limit is set use the limit string as a filter$SEP$# for the container name and see if it matches.