mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
YAML
36 lines
1.1 KiB
YAML
2 years ago
|
- hosts: testhost
|
||
|
gather_facts: no
|
||
|
tasks:
|
||
|
- name: test that a variable cannot inject raw arguments
|
||
|
shell: echo hi {{ chdir }}
|
||
|
vars:
|
||
|
chdir: mom chdir=/tmp
|
||
|
register: raw_injection
|
||
|
|
||
|
- name: test that a variable cannot inject kvp arguments as a kvp
|
||
|
file: path={{ test_file }} {{ test_input }}
|
||
|
vars:
|
||
|
test_file: "{{ output_dir }}/ansible_test_file"
|
||
|
test_input: "owner=test"
|
||
|
register: kvp_kvp_injection
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: test that a variable cannot inject kvp arguments as a value
|
||
|
file: state=absent path='{{ kvp_in_var }}'
|
||
|
vars:
|
||
|
kvp_in_var: "{{ output_dir }}' owner='test"
|
||
|
register: kvp_value_injection
|
||
|
|
||
|
- name: test that a missing filter fails
|
||
|
debug:
|
||
|
msg: "{{ output_dir | badfiltername }}"
|
||
|
register: filter_missing
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- raw_injection.stdout == 'hi mom chdir=/tmp'
|
||
|
- kvp_kvp_injection is failed
|
||
|
- kvp_value_injection.path.endswith("' owner='test")
|
||
|
- filter_missing is failed
|