-
-
Save svengo/91ee29f483c251161ee887dcca18a7a1 to your computer and use it in GitHub Desktop.
Prepare fresh Debian for ansible management by created user "ansible" in sudoers (needs public ssh-Key in PUBKEY)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# enable host for ansible | |
set -e | |
PUBKEY="" | |
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/99-ansible || echo "ansible ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers.d/99-ansible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment