|
@@ -0,0 +1,33 @@
|
|
|
|
+#!/bin/bash
|
|
|
|
+
|
|
|
|
+echo "Creating group"
|
|
|
|
+groupadd Ansible
|
|
|
|
+echo "Creating user"
|
|
|
|
+useradd -g Ansible -m -r -c "Ansible user" ansible
|
|
|
|
+echo "Set sudo rights"
|
|
|
|
+echo "%Ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/Ansible
|
|
|
|
+echo "Set remote access"
|
|
|
|
+mkdir /home/ansible/.ssh
|
|
|
|
+chmod 700 /home/ansible/.ssh
|
|
|
|
+curl -o /home/ansible/.ssh/authorized_keys https://git.xo.nl/marcel/deployment/raw/master/ansible.pub
|
|
|
|
+chown -R ansible:Ansible /home/ansible/.ssh
|
|
|
|
+echo "Enabling IPv6"
|
|
|
|
+sed -i '/net.ipv6.conf.all.disable_ipv6.*/d' /etc/sysctl.conf && sysctl -q -p && echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6
|
|
|
|
+if [[ "$(ip -br link | grep -v UNKNOWN | grep -v DOWN | grep -v veth | grep -v br | awk '{ print $1 }')" != "eth0" ]]
|
|
|
|
+then
|
|
|
|
+ echo "Configure GRUB"
|
|
|
|
+ sed -i 's/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"net.ifnames=0 /' /etc/default/grub
|
|
|
|
+ grub2-mkconfig -o $(find /boot -name grub.cfg)
|
|
|
|
+ mv /etc/sysconfig/network-scripts/ifcfg* /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
|
+ sed -i 's/NAME=.*/NAME=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
|
+ sed -i 's/DEVICE=.*/DEVICE=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
|
+else
|
|
|
|
+ echo "GRUB configuration not required"
|
|
|
|
+fi
|
|
|
|
+echo "install Teleport agent"
|
|
|
|
+read -p "Enter installation ID : " TELEPORT
|
|
|
|
+sudo bash -c "$(curl -fsSL https://xs.xo.nl/scripts/$TELEPORT/install-node.sh)"
|
|
|
|
+echo "Deployment is completed"
|
|
|
|
+echo "Reboot host in 5 seconds"
|
|
|
|
+sleep 5
|
|
|
|
+reboot
|