1---
2- debug:
3    msg: Start Deleted integration state for ios_prefix_lists ansible_connection={{
4      ansible_connection }}
5
6- block:
7    - include_tasks: _remove_config.yaml
8    - include_tasks: _populate_config.yaml
9
10    - name: Delete prefix list based on prefix name configured
11      register: result
12      cisco.ios.ios_prefix_lists: &id001
13        config:
14          - afi: ipv4
15            prefix_lists:
16              - name: 10
17              - name: test_prefix
18        state: deleted
19
20    - name: Assert that correct set of commands were generated
21      assert:
22        that:
23          - "{{ deleted_name['commands'] | symmetric_difference(result['commands']) |\
24            \ length == 0 }}"
25
26    - name: Delete provided Prefix lists config (IDEMPOTENT)
27      register: result
28      cisco.ios.ios_prefix_lists: *id001
29
30    - name: Assert that the previous task was idempotent
31      assert:
32        that:
33          - result.changed == false
34
35    - include_tasks: _remove_config.yaml
36    - include_tasks: _populate_config.yaml
37
38    - name: Delete prefix list based on AFI configured
39      register: result
40      cisco.ios.ios_prefix_lists: &id002
41        config:
42          - afi: ipv4
43        state: deleted
44
45    - name: Assert that correct set of commands were generated
46      assert:
47        that:
48          - "{{ deleted_afi['commands'] | symmetric_difference(result['commands']) |\
49            \ length == 0 }}"
50
51    - name: Delete provided Prefix lists config (IDEMPOTENT)
52      register: result
53      cisco.ios.ios_prefix_lists: *id002
54
55    - name: Assert that the previous task was idempotent
56      assert:
57        that:
58          - result.changed == false
59
60    - include_tasks: _remove_config.yaml
61    - include_tasks: _populate_config.yaml
62
63    - name: Delete ALL provided Prefix lists config
64      register: result
65      cisco.ios.ios_prefix_lists: &id003
66        state: deleted
67
68    - name: Assert that correct set of commands were generated
69      assert:
70        that:
71          - "{{ deleted_all['commands'] | symmetric_difference(result['commands']) |\
72            \ length == 0 }}"
73
74    - name: Delete ALL provided Prefix lists config (IDEMPOTENT)
75      register: result
76      cisco.ios.ios_prefix_lists: *id003
77
78    - name: Assert that the previous task was idempotent
79      assert:
80        that:
81          - result.changed == false
82  always:
83
84    - include_tasks: _remove_config.yaml
85