2018-04-18 15:43:54 +01:00
|
|
|
- name: integration/become/sudo_nonexistent.yml
|
2018-04-22 19:40:58 +01:00
|
|
|
hosts: test-targets
|
2018-04-09 15:04:40 +01:00
|
|
|
any_errors_fatal: true
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: Verify behaviour for non-existent accounts.
|
|
|
|
shell: whoami
|
|
|
|
become: true
|
|
|
|
become_user: slartibartfast
|
|
|
|
ignore_errors: true
|
|
|
|
register: out
|
2021-10-20 03:05:18 +01:00
|
|
|
when:
|
|
|
|
# https://github.com/ansible/ansible/pull/70785
|
|
|
|
- ansible_facts.distribution not in ["MacOSX"]
|
|
|
|
or ansible_version.full is version("2.11", ">=", strict=True)
|
|
|
|
or is_mitogen
|
2018-04-09 15:04:40 +01:00
|
|
|
|
|
|
|
- name: Verify raw module output.
|
|
|
|
assert:
|
2021-02-19 08:14:33 +00:00
|
|
|
that:
|
|
|
|
- out.failed
|
|
|
|
# sudo-1.8.6p3-29.el6_10.3 on RHEL & CentOS 6.10 (final release)
|
|
|
|
# removed user/group error messages, as defence against CVE-2019-14287.
|
|
|
|
- >-
|
|
|
|
('sudo: unknown user: slartibartfast' in out.module_stderr | default(out.msg))
|
2021-10-20 03:31:40 +01:00
|
|
|
or ('chown: slartibartfast: illegal user name' in out.module_stderr | default(out.msg))
|
2021-02-19 08:14:33 +00:00
|
|
|
or (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_version == '6.10')
|
2021-09-07 22:10:25 +01:00
|
|
|
fail_msg: out={{out}}
|
2021-10-20 03:05:18 +01:00
|
|
|
when:
|
|
|
|
# https://github.com/ansible/ansible/pull/70785
|
|
|
|
- ansible_facts.distribution not in ["MacOSX"]
|
|
|
|
or ansible_version.full is version("2.11", ">=", strict=True)
|
|
|
|
or is_mitogen
|
2021-11-02 20:07:28 +00:00
|
|
|
tags:
|
|
|
|
- sudo
|
|
|
|
- sudo_nonexistent
|