docker-ubuntu1804-ansible icon indicating copy to clipboard operation
docker-ubuntu1804-ansible copied to clipboard

Add `ansible` user to enable testing of roles with non-`root` user

Open percygrunwald opened this issue 6 years ago • 3 comments

Another change that I wanted to check if you'd consider merging.

Adds a non-root sudoer called ansible and ensures that sudo does not require a password to match how these images are set up in cloud providers like AWS/Azure/GCP.

Can be used with molecule/Docker like this:

# molecule/default/playbook.yml
---
- name: Converge
  hosts: all
  vars:
    ansible_user: ansible
  roles:
    - role: ...

percygrunwald avatar Feb 12 '19 05:02 percygrunwald

I would also be interessted in such feature as we cannot test playbooks as a normal user (and using become method)

:+1:

maximumG avatar Aug 13 '20 07:08 maximumG

@geerlingguy Any opinion on this? This is a needed feature to write complete tests with molecule.

nkakouros avatar Jun 26 '22 22:06 nkakouros

I do like this idea; the PR would need a bit of an update to work with the latest version, and I will only merge once I've had time to get it working across my other docker/ansible images (ubuntu 2004, 2204, debian 9/10/11 at least)

geerlingguy avatar Jun 27 '22 16:06 geerlingguy