new-suse.sh 1.2 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. echo "Creating group"
  3. groupadd Ansible
  4. echo "Creating user"
  5. useradd -g Ansible -m -r -c "Ansible user" ansible
  6. echo "Set sudo rights"
  7. echo "%Ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/Ansible
  8. echo "Set remote access"
  9. mkdir /home/ansible/.ssh
  10. chmod 700 /home/ansible/.ssh
  11. curl -o /home/ansible/.ssh/authorized_keys https://git.xo.nl/marcel/deployment/raw/master/ansible.pub
  12. chown -R ansible:Ansible /home/ansible/.ssh
  13. echo "Enabling IPv6"
  14. 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
  15. if [[ "$(ip -br link | grep -v UNKNOWN | grep -v DOWN | grep -v veth | grep -v br | awk '{ print $1 }')" != "eth0" ]]
  16. then
  17. echo "Configure GRUB"
  18. sed -i 's/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"net.ifnames=0 /' /etc/default/grub
  19. grub2-mkconfig -o $(find /boot -name grub.cfg)
  20. else
  21. echo "GRUB configuration not required"
  22. fi
  23. echo "install Teleport agent"
  24. read -p "Enter installation ID : " TELEPORT
  25. sudo bash -c "$(curl -fsSL https://xs.xo.nl/scripts/$TELEPORT/install-node.sh)"
  26. echo "Deployment is completed"
  27. echo "Reboot host in 5 seconds"
  28. sleep 5
  29. reboot