12345678910111213141516171819202122232425262728293031323334 |
- #!/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 }')" != "eth1" ]]
- 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 "Disable SELinux"
- sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
- echo "install Teleport agent"
- sudo bash -c "$(curl -fsSL https://xs.xo.nl/scripts/c368df0b0c8b08d92e3cfa66616c333a/install-node.sh)"
- echo "Deployment is completed"
- echo "Reboot host in 3 seconds"
- wait 3
- reboot
|