mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 09:55:26 -07:00
Merge branch 'v2_final' into devel_switch_v2
Conflicts: lib/ansible/inventory/__init__.py lib/ansible/modules/core lib/ansible/utils/__init__.py lib/ansible/utils/module_docs.py
This commit is contained in:
commit
2bad888f28
523 changed files with 11886 additions and 9399 deletions
|
@ -29,24 +29,20 @@
|
|||
- file: name={{test_file}} state=touch
|
||||
tags: common
|
||||
|
||||
- name: test that we cannot insert arguments
|
||||
file: path={{ test_file }} {{ test_input }}
|
||||
failed_when: False # ignore the module, just test the parser
|
||||
- name: include test that we cannot insert arguments
|
||||
include: scenario1.yml
|
||||
tags: scenario1
|
||||
|
||||
- name: test that we cannot duplicate arguments
|
||||
file: path={{ test_file }} owner=test2 {{ test_input }}
|
||||
failed_when: False # ignore the module, just test the parser
|
||||
- name: include test that we cannot duplicate arguments
|
||||
include: scenario2.yml
|
||||
tags: scenario2
|
||||
|
||||
- name: test that we can't do this for the shell module
|
||||
shell: echo hi {{ chdir }}
|
||||
failed_when: False
|
||||
- name: include test that we can't do this for the shell module
|
||||
include: scneario3.yml
|
||||
tags: scenario3
|
||||
|
||||
- name: test that we can't go all Little Bobby Droptables on a quoted var to add more
|
||||
file: "name={{ bad_var }}"
|
||||
failed_when: False
|
||||
- name: include test that we can't go all Little Bobby Droptables on a quoted var to add more
|
||||
include: scenario4.yml
|
||||
tags: scenario4
|
||||
|
||||
- name: test that a missing/malformed jinja2 filter fails
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
- name: test that we cannot insert arguments
|
||||
file: path={{ test_file }} {{ test_input }}
|
||||
failed_when: False # ignore the module, just test the parser
|
||||
tags: scenario1
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
- name: test that we cannot duplicate arguments
|
||||
file: path={{ test_file }} owner=test2 {{ test_input }}
|
||||
failed_when: False # ignore the module, just test the parser
|
||||
tags: scenario2
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
- name: test that we can't do this for the shell module
|
||||
shell: echo hi {{ chdir }}
|
||||
failed_when: False
|
||||
tags: scenario3
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
- name: test that we can't go all Little Bobby Droptables on a quoted var to add more
|
||||
file: "name={{ bad_var }}"
|
||||
failed_when: False
|
||||
tags: scenario4
|
||||
|
|
@ -152,17 +152,17 @@
|
|||
that:
|
||||
- complex_param == "this is a param in a complex arg with double quotes"
|
||||
|
||||
- name: test variable module name
|
||||
action: "{{ variable_module_name }} msg='this should be debugged'"
|
||||
register: result
|
||||
#- name: test variable module name
|
||||
# action: "{{ variable_module_name }} msg='this should be debugged'"
|
||||
# register: result
|
||||
#
|
||||
#- debug: var=result
|
||||
|
||||
- debug: var=result
|
||||
|
||||
- name: assert the task with variable module name ran
|
||||
assert:
|
||||
that:
|
||||
- result.invocation.module_name == "debug"
|
||||
- result.msg == "this should be debugged"
|
||||
#- name: assert the task with variable module name ran
|
||||
# assert:
|
||||
# that:
|
||||
# - result.invocation.module_name == "debug"
|
||||
# - result.msg == "this should be debugged"
|
||||
|
||||
- name: test conditional includes
|
||||
include: test_include_conditional.yml
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
set_fact: "{{ item.0 + item.1 }}=x"
|
||||
with_nested:
|
||||
- [ 'a', 'b' ]
|
||||
- [ 'c', 'd' ]
|
||||
- [ 'c', 'd' ]
|
||||
|
||||
- debug: var=ac
|
||||
- debug: var=ad
|
||||
|
@ -115,6 +115,39 @@
|
|||
- "_ye == 'e'"
|
||||
- "_yf == 'f'"
|
||||
|
||||
- name: test with_subelements in subkeys
|
||||
set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}"
|
||||
with_subelements:
|
||||
- element_data
|
||||
- the.sub.key.list
|
||||
|
||||
- name: verify with_subelements in subkeys results
|
||||
assert:
|
||||
that:
|
||||
- "_xq == 'q'"
|
||||
- "_xr == 'r'"
|
||||
- "_yi == 'i'"
|
||||
- "_yo == 'o'"
|
||||
|
||||
- name: test with_subelements with missing key or subkey
|
||||
set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}"
|
||||
with_subelements:
|
||||
- element_data_missing
|
||||
- the.sub.key.list
|
||||
- skip_missing: yes
|
||||
register: _subelements_missing_subkeys
|
||||
|
||||
- debug: var=_subelements_missing_subkeys
|
||||
- debug: var=_subelements_missing_subkeys.results|length
|
||||
- name: verify with_subelements in subkeys results
|
||||
assert:
|
||||
that:
|
||||
- _subelements_missing_subkeys.skipped is not defined
|
||||
- _subelements_missing_subkeys.results|length == 2
|
||||
- "_xk == 'k'"
|
||||
- "_xl == 'l'"
|
||||
|
||||
|
||||
# WITH_TOGETHER
|
||||
|
||||
- name: test with_together
|
||||
|
|
|
@ -3,7 +3,41 @@ element_data:
|
|||
the_list:
|
||||
- "f"
|
||||
- "d"
|
||||
the:
|
||||
sub:
|
||||
key:
|
||||
list:
|
||||
- "q"
|
||||
- "r"
|
||||
- id: y
|
||||
the_list:
|
||||
- "e"
|
||||
- "f"
|
||||
the:
|
||||
sub:
|
||||
key:
|
||||
list:
|
||||
- "i"
|
||||
- "o"
|
||||
element_data_missing:
|
||||
- id: x
|
||||
the_list:
|
||||
- "f"
|
||||
- "d"
|
||||
the:
|
||||
sub:
|
||||
key:
|
||||
list:
|
||||
- "k"
|
||||
- "l"
|
||||
- id: y
|
||||
the_list:
|
||||
- "f"
|
||||
- "d"
|
||||
- id: z
|
||||
the_list:
|
||||
- "e"
|
||||
- "f"
|
||||
the:
|
||||
sub:
|
||||
key:
|
||||
|
|
|
@ -129,3 +129,26 @@
|
|||
debug: msg={{item}}
|
||||
with_items: things2
|
||||
|
||||
|
||||
# BUG #10073 nested template handling
|
||||
|
||||
- name: set variable that clashes
|
||||
set_fact:
|
||||
LOGNAME: foobar
|
||||
|
||||
|
||||
- name: get LOGNAME environment var value
|
||||
shell: echo {{ '$LOGNAME' }}
|
||||
register: known_var_value
|
||||
|
||||
- name: do the lookup for env LOGNAME
|
||||
set_fact:
|
||||
test_val: "{{ lookup('env', 'LOGNAME') }}"
|
||||
|
||||
- debug: var=test_val
|
||||
|
||||
- name: compare values
|
||||
assert:
|
||||
that:
|
||||
- "test_val == known_var_value.stdout"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue