Skip to content
Snippets Groups Projects
Commit 9ddcbd05 authored by nimrod's avatar nimrod
Browse files

- Don't provision sudo, use the users role instead.

- Gather facts at the end of the role (subsequent tasks/ roles in the
play may need it).
parent 856dfe3e
No related branches found
No related tags found
No related merge requests found
...@@ -17,21 +17,5 @@ ...@@ -17,21 +17,5 @@
update_cache: yes update_cache: yes
cache_valid_time: 3600 cache_valid_time: 3600
- name: Install sudo - name: Gather facts
when: debian_bootstrap_sudo_group is defined setup:
apt:
name: sudo
state: present
update_cache: yes
cache_valid_time: 3600
- name: Allow sudo access
when: debian_bootstrap_sudo_group is defined
ignore_errors: "{{ ansible_check_mode }}"
lineinfile:
dest: '/etc/sudoers'
line: '%{{ debian_bootstrap_sudo_group }} ALL=(ALL) NOPASSWD: ALL'
regexp: '^%{{ debian_bootstrap_sudo_group }}'
state: present
owner: root
group: root
...@@ -5,8 +5,3 @@ testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') ...@@ -5,8 +5,3 @@ testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_example(Command): def test_example(Command):
assert Command('uname').rc == 0 assert Command('uname').rc == 0
def test_root(Command, Sudo):
with Sudo():
assert Command('whoami').stdout.strip() == 'root'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment