ansible/test/integration/targets/check_mode/check_mode-not-on-cli.yml
Matt Martz 8c08d03989
Fieldattribute inheritance with defaults (#50891)
* Add tests for check_mode at play and task level

These test inheritance of check_mode from the various levels (command
line, as a play attribute and as a task attribute) so they will be
useful for checking that the change to fieldattribute inheritance with
defaults works

* Add a sentinel object

The Sentinel object can be used in place of None when we need to mark an
entry as being special (usually used to mark something as not having
been set)

* Start of using a Sentinel object instead of None.

* Handle edge cases around use of Sentinel

* _get_parent_attribute needs to deal in Sentinel not None

* No need to special case any_errors_fatal in task.py any longer

* Handle more edge cases around Sentinel

* Use Sentinel instead of None in TaskInclude

* Update code to clarify the vars we are copying are class attrs

* Add changelog fragment

* Use a default of Sentinel for delegate_to, this also allows 'delegate_to: ~' now to unset inherited delegate_to

* Explain Sentinel stripping in _extend_value

* Fix ModuleArgsParser tests to compare with Sentinel

* Fixes for tasks inside of roles inheriting from play

* Remove incorrect note. ci_complete

* Remove commented code
2019-01-23 11:40:07 -06:00

37 lines
774 B
YAML

---
# Run withhout --check
- hosts: localhost
gather_facts: False
tasks:
- command: 'echo ran'
register: command_out
- debug: var=command_out
- name: check that this did not run in check mode
assert:
that:
- '"ran" in command_out["stdout"]'
- hosts: localhost
gather_facts: False
check_mode: True
tasks:
- command: 'echo ran'
register: command_out
- name: check that play level check_mode overrode the cli
assert:
that:
- '"check mode" in command_out["msg"]'
- hosts: localhost
gather_facts: False
tasks:
- command: 'echo ran'
register: command_out
check_mode: True
- name: check that task level check_mode overrode the cli
assert:
that:
- '"check mode" in command_out["msg"]'