Running the following as root will:

  • create a group called ansible with an id of 30000
  • create a group called devops with an id of 30001
  • create a user called ansible with a password of mypass123 with a primary group of ansible and a secondary group of devops
  • setup passwordless root access via sudo for the ansible account 

groupadd --gid 30000 ansible && \
groupadd --gid 30001 devops && \
useradd --uid 30000 ansible -m -g ansible --groups devops && \
echo -e "mypass123\nmypass123" | passwd ansible && \
echo "%devops ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/10_devops