summaryrefslogtreecommitdiffstats
path: root/examples/playbooks/rule-jinja-pass.yml
blob: cbdfee63faebdb9ceb132578f65239ddb9d1b8e0 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
# https://github.com/ansible/ansible-lint/issues/2464
# https://github.com/ansible/ansible-lint/issues/2462
# https://github.com/ansible/ansible-lint/issues/2459
- name: Fixture to test various jinja parsing bugs that we should ignore
  hosts: localhost
  tasks:
    - name: Foo {{ buildset_registry.host | ipwrap }}
      ansible.builtin.debug:
        msg: "{{ lookup('template', 'lookup/redis_server__env_ports.j2') | from_yaml }}"
      loop: "{{ github_release_query.results | subelements('json.assets', {'skip_missing': True}) }}"
    - name: Zoo
      ansible.builtin.debug:
        msg: "{{ lookup('ansible.builtin.ini', 'SOME_VAR', type='properties', file='/tmp/some-file') }}"

    - name: Generate Dovecot main configuration file
      ansible.builtin.template:
        src: '{{ lookup("template_src", "etc/dovecot/dovecot.conf.j2") }}'
        dest: "/etc/dovecot/dovecot.conf"
        owner: "root"
        group: "dovecot"
        mode: "0640"
    - name: Bug https://github.com/ansible/ansible-lint/issues/2569
      ansible.builtin.include_tasks:
        file: /dev/null
      vars:
        ns_vars: {}
        x: "{{ lookup('ansible.builtin.template', 'namespace.yaml.j2', template_vars=ns_vars) | from_yaml }}"
    - name: Bug https://github.com/ansible/ansible-lint/issues/3048
      ansible.builtin.set_fact:
        x: "{{ y.json | community.general.json_query(edition.version) }}"

# https://github.com/ansible/ansible-lint/issues/2697
- name: Test linter
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Passed linter
      ansible.builtin.debug:
        msg: "{{ test | to_json }}"
      vars:
        test:
          one: two
          param: "{{ ansible_host }}"
    - name: Failed linter
      ansible.builtin.debug:
        msg: "{{ test | to_json }}"
      vars:
        test:
          one: two
          param: no jinja

- name: Bug https://github.com/ansible/ansible-lint/issues/3048
  hosts: localhost
  tasks:
    - name: "Test for bug #3048"
      ansible.builtin.debug:
        msg: "{{ __my_var | mandatory }}"
      loop: "{{ a_var }}"
      loop_control:
        loop_var: __my_var
      vars:
        a_var:
          - one

- name: Bugs
  hosts: localhost
  tasks:
    - name: Bug https://github.com/ansible/ansible-lint/issues/3082
      ansible.builtin.copy:
        content: "{{ item.cfg | to_nice_yaml(indent=2, width=9999) }}"
        dest: "/tmp/{{ item.name }}.yaml"
        mode: "0640"
      with_items:
        - name: file2

    - name: Bug https://github.com/ansible/ansible-lint/issues/3136
      ansible.builtin.debug:
        msg: "IP is {{ foo | ansible.utils.ipaddr('address') }}"

    - name: "Bug https://github.com/ansible/ansible-lint/issues/3155"
      ansible.builtin.debug:
        msg: "Is changed:{{ date_cmd is changed }}"