def _append_container_types(inventory, host_type):
 for _host in inventory['_meta']['hostvars'].keys():
  hdata = inventory['_meta']['hostvars'][_host]
  if ('container_name' in hdata):
   if hdata['container_name'].startswith(host_type):
    if ('physical_host' not in hdata):
     logger.debug('Set physical host for %s to %s', _host, host_type)
     hdata['physical_host'] = host_type

def _append_container_types ( inventory , host_type ) : for _host in inventory [ '_meta' ] [ 'hostvars' ] . keys ( ) : hdata = inventory [ '_meta' ] [ 'hostvars' ] [ _host ] if ( 'container_name' in hdata ) : if hdata [ 'container_name' ] . startswith ( host_type ) : if ( 'physical_host' not in hdata ) : logger . debug ( 'Set physical host for %s to %s' , _host , host_type ) hdata [ 'physical_host' ] = host_type
append the "physical_host" type to all containers .