geerlingguy / docker-ubuntu2004-ansible

Ubuntu 20.04 LTS (Focal Fossa) Docker container for Ansible playbook and role testing.
https://hub.docker.com/r/geerlingguy/docker-ubuntu2004-ansible
MIT License
83 stars 49 forks source link

Add non-root user to the image? #20

Open natemarks opened 3 years ago

natemarks commented 3 years ago

I was looking at this exapmpe. I can fork and PR if you want. https://molecule.readthedocs.io/en/latest/examples.html

# Createansibleuser with sudo permissions and membership inDEPLOY_GROUP ENV ANSIBLE_USER=ansible SUDO_GROUP=sudo DEPLOY_GROUP=deployer RUN set -xe \ && groupadd -r ${ANSIBLE_USER} \ && groupadd -r ${DEPLOY_GROUP} \ && useradd -m -g ${ANSIBLE_USER} ${ANSIBLE_USER} \ && usermod -aG ${SUDO_GROUP} ${ANSIBLE_USER} \ && usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \ && sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers