File: parsing.yml

package info (click to toggle)
ansible-core 2.19.0~beta6-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,628 kB
  • sloc: python: 180,313; cs: 4,929; sh: 4,601; xml: 34; makefile: 21
file content (35 lines) | stat: -rw-r--r-- 1,103 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- 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