2018-02-27 07:54:40 +00:00
|
|
|
# Verify the behaviour of _low_level_execute_command().
|
|
|
|
|
2018-04-18 14:43:54 +00:00
|
|
|
- name: integration/action__low_level_execute_command.yml
|
|
|
|
hosts: all
|
2018-04-04 23:11:29 +00:00
|
|
|
any_errors_fatal: true
|
2018-02-27 07:54:40 +00:00
|
|
|
tasks:
|
2018-04-04 19:01:23 +00:00
|
|
|
|
2018-02-27 07:54:40 +00:00
|
|
|
# "echo -en" to test we actually hit bash shell too.
|
|
|
|
- name: Run raw module without sudo
|
|
|
|
raw: 'echo -en $((1 + 1))'
|
|
|
|
register: raw
|
|
|
|
|
|
|
|
- name: Verify raw module output.
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- 'raw.rc == 0'
|
|
|
|
- 'raw.stdout_lines == ["2"]'
|
|
|
|
- 'raw.stdout == "2"'
|
|
|
|
|
|
|
|
- name: Run raw module with sudo
|
|
|
|
become: true
|
|
|
|
raw: 'whoami'
|
|
|
|
register: raw
|
|
|
|
|
|
|
|
# Can't test stdout because TTY inserts \r in Ansible version.
|
|
|
|
- debug: msg={{raw}}
|
|
|
|
- name: Verify raw module output.
|
|
|
|
assert:
|
2018-04-17 14:57:32 +00:00
|
|
|
that:
|
|
|
|
- raw.rc == 0
|
|
|
|
# WHY DOES VANILLA ANSIBLE INSERT NEWLINES HERE!?!?!?!?!?!ONE
|
|
|
|
- raw.stdout in ("\r\nroot\r\n", "root\r\n")
|
|
|
|
- raw.stdout_lines in (["", "root"], ["root"])
|