#!/bin/bash ifid"ansible" >/dev/null 2>&1; then usermod -aG root ansible else useradd ansible -m -s /bin/bash -g root -c "ansible control user" fi
echo'$PASSWD' | passwd --stdin ansible
if [ -f "/home/ansible/.ssh/authorized_keys" ]; then if grep -q "<contorl-Public-key>"; then echo"" else echo"<contorl-Public-key>" >> /home/ansible/.ssh/authorized_keys fi else mkdir -p /home/ansible/.ssh echo"<contorl-Public-key>" >> /home/ansible/.ssh/authorized_keys fi
if [ -f "/etc/sudoers.d/ansible-user" ]; then if grep -q "ansible ALL=(ALL)NOPASSWD: ALL""/etc/sudoers.d/ansible-user"; then echo"" else sudo echo"ansible ALL=(ALL)NOPASSWD: ALL" >> /etc/sudoers.d/ansible-user fi else sudo echo"ansible ALL=(ALL)NOPASSWD: ALL" >> /etc/sudoers.d/ansible-user fi