123456789101112131415161718192021222324 |
- #!/bin/bash
- echo "Install sudo"
- dnf -y install sudo
- 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 "Disable SELinux"
- sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
- setenforce 0
- echo "Disable root login"
- sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
- sed -i 's/PermitRootLogin without-password/PermitRootLogin no/' /etc/ssh/sshd_config
- echo "Deployment is completed, system reboot in 5 seconds"
- sleep 5
- reboot
|