Skip to content

Instantly share code, notes, and snippets.

@JonTheNiceGuy
Last active December 6, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonTheNiceGuy/d19c26ed6ff7621fde1e84ceda8a473f to your computer and use it in GitHub Desktop.
Save JonTheNiceGuy/d19c26ed6ff7621fde1e84ceda8a473f to your computer and use it in GitHub Desktop.
---
- hosts: localhost
gather_facts: false
vars:
a_list: ['1', '2', '3']
a_dict: {'a': 'value', 'b': 'value'}
a_string: "abc123"
a_list_of_dicts: [{'a': 'value'}, {'a': 'value'}]
tasks:
- debug:
msg: |
[
"a_list is a list? {{ a_list is sequence() }}",
"a_list is a dict? {{ a_list is mapping() }}",
"a_list is neither? {{ (not a_list is sequence()) and (not a_list is mapping()) }}",
"",
"a_dict is a list? {{ a_dict is sequence() }}",
"a_dict is a dict? {{ a_dict is mapping() }}",
"a_dict is neither? {{ (not a_dict is sequence()) and (not a_dict is mapping()) }}",
"",
"a_string is a list? {{ a_string is sequence() }}",
"a_string is a dict? {{ a_string is mapping() }}",
"a_string is neither? {{ (not a_string is sequence()) and (not a_string is mapping()) }}",
"",
"a_list_of_dicts is a list? {{ a_list_of_dicts is sequence() }}",
"a_list_of_dicts is a dict? {{ a_list_of_dicts is mapping() }}",
"a_list_of_dicts is neither? {{ (not a_list_of_dicts is sequence()) and (not a_list_of_dicts is mapping()) }}"
]
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] *******************************************************************************************************************
TASK [debug] ***********************************************************************************************************************
ok: [localhost] => {
"msg": [
"a_list is a list? True",
"a_list is a dict? False",
"a_list is neither? False",
"",
"a_dict is a list? False",
"a_dict is a dict? True",
"a_dict is neither? False",
"",
"a_string is a list? False",
"a_string is a dict? False",
"a_string is neither? True",
"",
"a_list_of_dicts is a list? True",
"a_list_of_dicts is a dict? False",
"a_list_of_dicts is neither? False"
]
}
PLAY RECAP *************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] *******************************************************************************************************************
TASK [debug] ***********************************************************************************************************************
ok: [localhost] => {
"msg": [
"a_list is a list? True",
"a_list is a dict? False",
"a_list is neither? False",
"",
"a_dict is a list? True",
"a_dict is a dict? True",
"a_dict is neither? False",
"",
"a_string is a list? True",
"a_string is a dict? False",
"a_string is neither? False",
"",
"a_list_of_dicts is a list? True",
"a_list_of_dicts is a dict? False",
"a_list_of_dicts is neither? False"
]
}
PLAY RECAP *************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment