File: test_inventory_cache.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 (34 lines) | stat: -rw-r--r-- 1,366 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
- hosts: localhost
  gather_facts: no
  vars:
    cache_options_message: "Cache options were provided but may not reconcile correctly unless set via set_options"
    no_parse_message: "No inventory was parsed, only implicit localhost is available"
    expected_host_name: host1
    base_environment:
      ANSIBLE_FORCE_COLOR: 0
    legacy_cache:
      DUMMY_CACHE_SKIP_SUPER: 1
  tasks:
    - name: legacy-style cache plugin should cause a warning
      command: ansible-inventory -i test.inventoryconfig.yml --graph --playbook-dir .
      register: result
      environment: "{{ base_environment | combine(legacy_cache) }}"

    - name: test warning output (no inventory)
      assert:
        that:
          - result.stderr is contains cache_options_message
          - result.stderr is contains no_parse_message
          - result.stdout is not contains expected_host_name

    - name: cache plugin updated to use config manager should work
      command: ansible-inventory -i test.inventoryconfig.yml --graph --playbook-dir .
      register: result
      environment: "{{ base_environment }}"

    - name: test warning output (inventory parse success)
      assert:
        that:
          - result.stderr is not contains cache_options_message
          - result.stderr is not contains no_parse_message
          - result.stdout is contains expected_host_name