--- - debug: msg: "START vyos_firewall_rules merged integration tests on connection={{ ansible_connection }}" - include_tasks: _populate.yaml - include_tasks: _remove_config.yaml - block: - name: Merge the provided configuration with the exisiting running configuration vyos_firewall_rules: &merged config: - afi: 'ipv6' rule_sets: - name: 'UPLINK' description: 'This is ipv6 specific rule-set' default_action: 'accept' rules: - number: 1 action: 'accept' description: 'Fwipv6-Rule 1 is configured by Ansible' ipsec: 'match-ipsec' - number: 2 action: 'accept' description: 'Fwipv6-Rule 2 is configured by Ansible' ipsec: 'match-ipsec' - afi: 'ipv4' rule_sets: - name: 'INBOUND' description: 'IPv4 INBOUND rule set' default_action: 'accept' rules: - number: 101 action: 'accept' description: 'Rule 101 is configured by Ansible' ipsec: 'match-ipsec' - number: 102 action: 'reject' description: 'Rule 102 is configured by Ansible' ipsec: 'match-ipsec' - number: 103 action: 'accept' description: 'Rule 103 is configured by Ansible' destination: group: address_group: 'inbound' source: address: '192.0.2.0' state: established: true new: false invalid: false related: true state: merged register: result - name: Assert that before dicts were correctly generated assert: that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) vyos_firewall_rules: *merged register: result - name: Assert that the previous task was idempotent assert: that: - "result['changed'] == false" - name: Assert that before dicts were correctly generated assert: that: - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml