File: module_output_cleaning.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 (33 lines) | stat: -rw-r--r-- 871 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
- name: ensure we clean module output well
  hosts: localhost
  gather_facts: false
  tasks:
    - name: where is bash
      shell: command -v bash
      register: bash
      changed_when: false

    - name: call module that spews extra stuff
      bad_json:
      register: clean_json
      ignore_errors: true
      vars:
        ansible_bash_interpreter: '{{ bash.stdout }}'

    - name: all expected is there
      assert:
        that:
          - clean_json is success
          - clean_json is not changed
          - "clean_json['msg'] == 'good json response'"

    - name: all non wanted is not there
      assert:
        that:
          - item not in clean_json.values()
      loop:
         - this stuff should be ignored
         - [ looks like a json list]
         - '[ looks like a json list]'
         - ' looks like a json list'
         - moar garbage