Cleaning up includes test to match 2.0 behavior

* Perhaps the only precedence change, in 2.0+ variables from set_fact
  will not override params to an include file, as params are expected
  to be more specific than host-based variables.
* Uncommented long-form include example.
This commit is contained in:
James Cammarata 2015-07-10 10:56:14 -04:00
parent d81ea397aa
commit 5430169b77

View file

@ -26,12 +26,16 @@
- "cb == '2'"
- "cc == '3'"
# Fact takes precedence over include param as fact is host-specific
- set_fact:
a: 101
b: 102
c: 103
# Params specified via k=v values are strings, while those
# that come from variables will keep the type they were previously.
# Prior to v2.0, facts too priority over include params, however
# this is no longer the case.
- include: included_task1.yml a={{a}} b={{b}} c=103
- name: verify variable include params
@ -39,7 +43,7 @@
that:
- "ca == 101"
- "cb == 102"
- "cc == 103"
- "cc == '103'"
# Test that strings are not turned into numbers
- set_fact:
@ -57,26 +61,23 @@
- "cc == '103'"
# now try long form includes
#
# FIXME: not sure if folks were using this, or if vars were top level, but seems like
# it should be a thing.
#
#- include: included_task1.yml
# vars:
# a: 201
# b: 202
# c: 203
#
#- debug: var=a
#- debug: var=b
#- debug: var=c
#
#- name: verify long-form include params
# assert:
# that:
# - "ca == 201"
# - "cb == 202"
# - "cc == 203"
- include: included_task1.yml
vars:
a: 201
b: 202
c: 203
- debug: var=a
- debug: var=b
- debug: var=c
- name: verify long-form include params
assert:
that:
- "ca == 201"
- "cb == 202"
- "cc == 203"
- name: test handlers with includes
shell: echo 1