You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
675 B
11 lines
675 B
#!/bin/bash
|
|
# enable host for ansible
|
|
set -e
|
|
PUBKEY="ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAEuwAZEN/DNkr1KkBsHdw1kRV964httL4gqpstBgComJy549miU2Cul0ozyl76qv8L6BNCzQywW86Kbb2h8glufSwCDwbcZpmQUN4lRDctrWHUU8R2mPLwSQfFqc+AVYomotegaVOnSwQzpOkTJIv94LWI3Amsfo0L/2V8JY0cb3WNMIg== root@ansible-host"
|
|
id -u ansible > /dev/null 2>&1 || adduser ansible --disabled-password --gecos "" --quiet
|
|
mkdir -p /home/ansible/.ssh
|
|
echo "$PUBKEY" > /home/ansible/.ssh/authorized_keys
|
|
chown -R ansible /home/ansible/.ssh
|
|
apt-get update
|
|
apt-get install sudo
|
|
grep -q ansible /etc/sudoers.d/ansible || echo "ansible ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ansible
|