|
|
|
@ -6,11 +6,15 @@ if [ "$(id -u)" != "0" ]; then |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
set -e |
|
|
|
PUBKEY="ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAEuwAZEN/DNkr1KkBsHdw1kRV964httL4gqpstBgComJy549miU2Cul0ozyl76qv8L6BNCzQywW86Kbb2h8glufSwCDwbcZpmQUN4lRDctrWHUU8R2mPLwSQfFqc+AVYomotegaVOnSwQzpOkTJIv94LWI3Amsfo0L/2V8JY0cb3WNMIg== root@ansible-host" |
|
|
|
|
|
|
|
# Update and Upgrade the System |
|
|
|
apt update && apt upgrade -y |
|
|
|
|
|
|
|
# Install sudo and other necessary packages |
|
|
|
apt install -y sudo openssh-server |
|
|
|
apt install -y sudo openssh-server curl gnupg2 |
|
|
|
|
|
|
|
|
|
|
|
# Create the ansible user |
|
|
|
useradd -m -s /bin/bash ansible |
|
|
|
@ -22,7 +26,7 @@ touch /home/ansible/.ssh/authorized_keys |
|
|
|
chmod 600 /home/ansible/.ssh/authorized_keys |
|
|
|
|
|
|
|
# Replace 'your_public_key' with the actual public key |
|
|
|
echo 'your_public_key' > /home/ansible/.ssh/authorized_keys |
|
|
|
echo "$PUBKEY" > /home/ansible/.ssh/authorized_keys |
|
|
|
|
|
|
|
# Change ownership of the .ssh directory to the ansible user |
|
|
|
chown -R ansible:ansible /home/ansible/.ssh |
|
|
|
|