2018-04-09 14:04:40 +00:00
|
|
|
# Verify passwordless sudo behaviour in various cases.
|
|
|
|
|
2021-11-02 20:07:28 +00:00
|
|
|
- name: integration/become/sudo_nopassword.yml
|
2018-04-22 18:40:58 +00:00
|
|
|
hosts: test-targets
|
2018-04-09 14:04:40 +00:00
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: Verify we aren't root
|
|
|
|
shell: whoami
|
|
|
|
register: out
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.stdout != 'root'
|
2021-09-07 21:10:25 +00:00
|
|
|
fail_msg: out={{out}}
|
2018-04-09 14:04:40 +00:00
|
|
|
|
|
|
|
- name: Ensure passwordless sudo to root succeeds.
|
|
|
|
shell: whoami
|
|
|
|
become: true
|
|
|
|
become_user: root
|
|
|
|
register: out
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.stdout == 'root'
|
2021-09-07 21:10:25 +00:00
|
|
|
fail_msg: out={{out}}
|
2021-11-02 20:07:28 +00:00
|
|
|
tags:
|
|
|
|
- sudo
|
|
|
|
- sudo_nopassword
|