Répertoire :/shareProd/1and1/local/appli/OS/Ubuntu/scripts

Serveur de fichiers : UbuntuProd-00 Ip:192.168.1.143

Script :  NetworkSetting.ksh

 

#!/usr/bin/ksh
IP=$1
[ A$IP = A ] && echo "Usage : $0 192.168.1.XX" && exit
mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.org

# create new
echo "
network:
ethernets:
# interface name
enp1s0:
dhcp4: no
# IP address/subnet mask
addresses: [${IP}/24]
# default gateway
gateway4: 192.168.1.254
nameservers:
# name server to bind
addresses: [192.168.1.0]
dhcp6: no
" > /etc/netplan/01-netcfg.yaml

netplan apply

 

RUN Script :

$ ksh /shareProd/1and1/local/appli/OS/Ubuntu/scripts/NetworkSetting.ksh 192.168.1.XX