Skip to content

Instantly share code, notes, and snippets.

@aboyett
Last active December 9, 2015 07:41
Show Gist options
  • Save aboyett/8d4fccb825846193baa9 to your computer and use it in GitHub Desktop.
Save aboyett/8d4fccb825846193baa9 to your computer and use it in GitHub Desktop.
ansible variable type preservation test
---
- name: type preservation test
hosts: localhost
sudo: no
gather_facts: no
vars:
num_var: 5
num_ref: "{{ num_var }}"
num_cast_ref: "{{ num_var | int }}"
bool_var: yes
bool_ref: "{{ bool_var }}"
nul: null
null_ref: "{{ nul }}"
null2: None
null2_ref: "{{ null }}"
var_map:
num: "{{ num_var }}"
num_ref: "{{ num_ref | int }}"
num_ref_cast: "{{ num_ref | int }}"
num_cast_ref: "{{ num_cast_ref }}"
num_cast_ref_cast: "{{ num_cast_ref | int }}"
bool_var: "{{ bool_var }}"
bool_ref: "{{ bool_ref }}"
nul: "{{ nul }}"
null_ref: "{{ null_ref }}"
null2_map:
null2: "{{ null2 }}"
null2_ref: "{{ null2_ref }}"
tasks:
- name: numeric type preservation test
debug: var=var_map
- name: "null evaluation failure"
debug: var=null2_map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment