added network configuration
This commit is contained in:
parent
cb7abf7c82
commit
1993f193c6
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
network.env
|
||||
salt/pillars/local.sls
|
||||
|
26
update.sh
26
update.sh
@ -7,6 +7,7 @@ function printHelp(){
|
||||
cat << EOF
|
||||
Usage ${0##*/} [options..]
|
||||
-h,-?, --help Show help and exit
|
||||
-N, --network configure network settings
|
||||
-s, --salt run a masterless salt-call
|
||||
-y, --yes answer 'yes' on all questions
|
||||
EOF
|
||||
@ -64,6 +65,25 @@ function do_salt_call(){
|
||||
$salt state.apply pillar="{username: $USER}"
|
||||
}
|
||||
|
||||
function configure_network(){
|
||||
new_log "Configure network"
|
||||
if asktobreak; then
|
||||
return
|
||||
fi
|
||||
source network.env
|
||||
sudo nmcli connection show
|
||||
sudo nmcli connection modify "$INTERNAL_IF" ipv4.addresses "$INTERNAL_ADDRESS"
|
||||
sudo nmcli connection modify "$INTERNAL_IF" ipv4.dns "127.0.0.1, 1.1.1.1, 1.1.1.2"
|
||||
sudo nmcli connection modify "$INTERNAL_IF" ipv4.method manual
|
||||
sudo nmcli connection down "$INTERNAL_IF"
|
||||
sudo nmcli connection up "$INTERNAL_IF"
|
||||
|
||||
sudo nmcli connection add type vlan con-name "$EXTERNAL_IF" ifname "$EXTERNAL_IF" dev "$INTERNAL_IF" id "${EXTERNAL_IF#*.}"
|
||||
sudo nmcli connection modify "$EXTERNAL_IF" ipv4.method auto
|
||||
sudo nmcli connection up "$EXTERNAL_IF"
|
||||
|
||||
|
||||
}
|
||||
|
||||
#########################
|
||||
#
|
||||
@ -74,6 +94,7 @@ function do_salt_call(){
|
||||
#initialize all options
|
||||
ALL=true
|
||||
SALT=false
|
||||
NETWORK=false
|
||||
ANSWER_YES=false
|
||||
|
||||
while :; do
|
||||
@ -86,6 +107,10 @@ while :; do
|
||||
SALT=true
|
||||
ALL=false
|
||||
;;
|
||||
-N|--network)
|
||||
NETWORK=true
|
||||
ALL=false
|
||||
;;
|
||||
-y|--yes)
|
||||
ANSWER_YES=true
|
||||
;;
|
||||
@ -107,6 +132,7 @@ for cmd in git salt-minion curl;do
|
||||
check_prerequisites "$cmd"
|
||||
done
|
||||
|
||||
[[ $ALL == true ]] || [[ $NETWORK == true ]] && configure_network
|
||||
[[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call
|
||||
|
||||
printf "\n DONE!!!!!!!\n"
|
||||
|
Loading…
Reference in New Issue
Block a user