replacing public ip with private in /etc/hosts

7 views
Skip to first unread message

Auto-mate

unread,
Aug 29, 2016, 10:24:36 AM8/29/16
to Ansible Project
I am trying to replace public ip  with private ip in /etc/hosts for bulk of hosts . 

Current setup


PUBLIC_IP   hostname  shot_hostname 

Needed :
 
PRIVATE _IP hostname  short_hostname



How I can do it using ansible? I wonder if it can be done using gathered facts by ansible? 
I would think of , getting the public ip and register as  variable and same time get the private ip . 
Now, replacing it using replace or inline module. Any best approach ?
Reply all
Reply to author
Forward
0 new messages