You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible/integration/become/sudo_password.yml

50 lines
1.2 KiB
YAML

# Verify passwordful sudo behaviour
- name: integration/become/sudo_password.yml
hosts: test-targets
any_errors_fatal: true
tasks:
- name: Ensure sudo password absent but required.
shell: whoami
become: true
become_user: mitogen__pw_required
register: out
ignore_errors: true
- assert:
that: |
out.failed and (
('password is required' in out.msg) or
('Missing sudo password' in out.msg) or
('password is required' in out.module_stderr)
)
- name: Ensure password sudo incorrect.
shell: whoami
become: true
become_user: mitogen__pw_required
register: out
vars:
ansible_become_pass: nopes
ignore_errors: true
- assert:
that: |
out.failed and (
('Incorrect sudo password' in out.msg) or
('sudo password is incorrect' in out.msg)
)
- name: Ensure password sudo succeeds.
shell: whoami
become: true
become_user: mitogen__pw_required
register: out
vars:
ansible_become_pass: pw_required_password
- assert:
that:
- out.stdout == 'mitogen__pw_required'