def migrate_node_facts(facts):
 params = {'common': 'dns_ip'}
 if ('node' not in facts):
  facts['node'] = {}
 for role in params.keys():
  if (role in facts):
   for param in params[role]:
    if (param in facts[role]):
     facts['node'][param] = facts[role].pop(param)
 return facts

def migrate_node_facts ( facts ) : params = { 'common' : 'dns_ip' } if ( 'node' not in facts ) : facts [ 'node' ] = { } for role in params . keys ( ) : if ( role in facts ) : for param in params [ role ] : if ( param in facts [ role ] ) : facts [ 'node' ] [ param ] = facts [ role ] . pop ( param ) return facts
migrate facts from various roles into node .