[Distem] Set the network connectivity inside the provider logic
Currently one needs to set up explicitly the network connectivity using this snippet of code:
roles, networks = provider.init()
gateway = networks[0]['gateway']
print("Gateway : %s" % gateway)
with play_on(roles=roles, gather_facts=False) as p:
# We first need internet connectivity
# Netmask for a subnet in g5k is a /14 netmask
p.shell("ifconfig if0 $(hostname -I) netmask 255.252.0.0")
p.shell("route add default gw %s dev if0" % gateway)
We propose to move this logic inside the Distem.init
method.
Additionally It is advised to use the raw
module instead of the shell
module to do so.