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'" - "cb == '2'"
- "cc == '3'" - "cc == '3'"
# Fact takes precedence over include param as fact is host-specific
- set_fact: - set_fact:
a: 101 a: 101
b: 102 b: 102
c: 103 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 - include: included_task1.yml a={{a}} b={{b}} c=103
- name: verify variable include params - name: verify variable include params
@ -39,7 +43,7 @@
that: that:
- "ca == 101" - "ca == 101"
- "cb == 102" - "cb == 102"
- "cc == 103" - "cc == '103'"
# Test that strings are not turned into numbers # Test that strings are not turned into numbers
- set_fact: - set_fact:
@ -57,26 +61,23 @@
- "cc == '103'" - "cc == '103'"
# now try long form includes # now try long form includes
#
# FIXME: not sure if folks were using this, or if vars were top level, but seems like - include: included_task1.yml
# it should be a thing. vars:
# a: 201
#- include: included_task1.yml b: 202
# vars: c: 203
# a: 201
# b: 202 - debug: var=a
# c: 203 - debug: var=b
# - debug: var=c
#- debug: var=a
#- debug: var=b - name: verify long-form include params
#- debug: var=c assert:
# that:
#- name: verify long-form include params - "ca == 201"
# assert: - "cb == 202"
# that: - "cc == 203"
# - "ca == 201"
# - "cb == 202"
# - "cc == 203"
- name: test handlers with includes - name: test handlers with includes
shell: echo 1 shell: echo 1