File: json_output.yml

package info (click to toggle)
ansible-core 2.19.0~beta6-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • 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-- 1,014 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
- block:
  - name: check baseline
    command: ansible-inventory -i '{{ role_path }}/files/valid_sample.yml' --list
    register: limited

  - name: ensure non empty host list
    assert:
      that:
        - "'something' in inv['_meta']['hostvars']"

  - name: check that limit removes host
    command: ansible-inventory -i '{{ role_path }}/files/valid_sample.yml'  --limit '!something' --list
    register: limited

  - name: ensure empty host list
    assert:
      that:
        - "'something' not in inv['_meta']['hostvars']"

  - name: check dupes
    command: ansible-inventory -i '{{ role_path }}/files/complex.ini' --list
    register: limited

  - name: ensure host only appears on directly assigned
    assert:
      that:
        - "'hosts' not in inv['parent_1']"
        - "'hosts' not in inv['parent_2']"
        - "'hosts' in inv['parent_3']"
        - "'test1' in inv['test_group1']['hosts']"
  vars:
    inv: '{{limited.stdout|from_json(profile="inventory_legacy") }}'
  delegate_to: localhost