Created
March 24, 2018 03:45
-
-
Save samos123/380e29e0c0aa9ec37af53dcf76e92aff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
while read host; do | |
echo "Setting correct dhcp network setting for $host" | |
ip=$(reclass-salt --pillar $host | grep single_address | grep -Eo "([0-9\.]*)$") | |
ssh $ip << EOF | |
if ! grep -q "ens2 inet dhcp" /etc/network/interfaces; then | |
cat << EOT >> /etc/network/interfaces | |
auto ens2 | |
iface ens2 inet dhcp | |
EOT | |
fi | |
ifup ens2 | |
EOF | |
done < down-nodes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment