When I spin up new virtual machines in the lab they come into the world with the same IP (.69) and the hostname of ‘template’. The following recipe makes updating the hostname and networking details a breeze. If the my workstation can resolve the new hostname to an IP (DNS or /etc/hosts) deprec will make sensible suggestions for network addresses.
$ cap deprec:network:config HOSTS=lucid triggering load callbacks * executing `deprec:connect_canonical_tasks' * executing `deprec:network:config' * executing `deprec:network:hostname' Enter the hostname for the server lucid2 <...lines removed for clarity...> Number of network interfaces |1| address |192.168.56.105| netmask |255.255.255.0| broadcast |192.168.56.255| default gateway |192.168.56.1| <...lines removed for clarity...> About to restart networking on lucid Are you 'down with that'? |y| y * executing "sudo -p 'sudo password: ' /etc/init.d/networking restart" servers: ["lucid"] [lucid] executing command ** [out :: lucid] * Reconfiguring network interfaces... ** [out :: lucid]
I set the following in ~/.caprc so I don’t get prompted for DNS servers and search path.
set :network_dns_nameservers, '184.108.40.206 220.127.116.11' set :network_dns_search_path, 'failmode.com'