def remove_ip_addresses(inventory):
 hostvars = inventory['_meta']['hostvars']
 for (host, variables) in hostvars.items():
  if variables.get('is_metal', False):
   continue
  ip_vars = ['container_networks', 'container_address', 'ansible_host', 'ansible_ssh_host']
  for ip_var in ip_vars:
   variables.pop(ip_var, None)

def remove_ip_addresses ( inventory ) : hostvars = inventory [ '_meta' ] [ 'hostvars' ] for ( host , variables ) in hostvars . items ( ) : if variables . get ( 'is_metal' , False ) : continue ip_vars = [ 'container_networks' , 'container_address' , 'ansible_host' , 'ansible_ssh_host' ] for ip_var in ip_vars : variables . pop ( ip_var , None )
removes container ip address information from the inventory dictionary all container_networks information for containers will be deleted .