From 9ddcbd058547636afa503cf23fa48e677dc7a079 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Wed, 18 Jan 2017 08:21:37 +0200 Subject: [PATCH] - 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). --- tasks/main.yml | 20 ++------------------ tests/test_example.py | 5 ----- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 67722a1..e471ea7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,21 +17,5 @@ update_cache: yes cache_valid_time: 3600 -- name: Install sudo - when: debian_bootstrap_sudo_group is defined - 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 +- name: Gather facts + setup: diff --git a/tests/test_example.py b/tests/test_example.py index aaea500..4f4066c 100644 --- a/tests/test_example.py +++ b/tests/test_example.py @@ -5,8 +5,3 @@ testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') def test_example(Command): assert Command('uname').rc == 0 - - -def test_root(Command, Sudo): - with Sudo(): - assert Command('whoami').stdout.strip() == 'root' -- GitLab