diff --git a/tests/unbound_dnsbl.yml b/tests/unbound_dnsbl.yml index f246413..3dbb82b 100644 --- a/tests/unbound_dnsbl.yml +++ b/tests/unbound_dnsbl.yml @@ -1,123 +1,123 @@ ---- - -- name: Testing Unbound DNS general settings - hosts: localhost - gather_facts: no - module_defaults: - group/ansibleguy.opnsense.all: - firewall: "{{ lookup('ansible.builtin.env', 'TEST_FIREWALL') }}" - api_credential_file: "{{ lookup('ansible.builtin.env', 'TEST_API_KEY') }}" - ssl_verify: false - - ansibleguy.opnsense.list: - target: 'unbound_dnsbl' - - tasks: - - name: Listing - ansibleguy.opnsense.list: - register: opn_pre1 - failed_when: > - opn_pre1.failed or - 'data' not in opn_pre1 - - - name: Configuring - failing because of invalid type - ansibleguy.opnsense.unbound_dnsbl: - type: - - ANSIBLE_TEST_1 - register: opn_fail1 - failed_when: not opn_fail1.failed - when: not ansible_check_mode - - - name: Configuring - failing because of invalid address - ansibleguy.opnsense.unbound_dnsbl: - address: INVALID - register: opn_fail2 - failed_when: not opn_fail2.failed - when: not ansible_check_mode - - - name: Reset Configuring - ansibleguy.opnsense.unbound_dnsbl: - when: not ansible_check_mode - - - name: Configuring - ansibleguy.opnsense.unbound_dnsbl: - type: - - atf - lists: ['https://example.com/dns.blocklist'] - whitelists: - - opnsense.org - - ansibleguy.net - blocklists: - - example.tor - wildcards: - - example.tor - address: 192.168.255.255 - nxdomain: false - enabled: true - register: opn1 - failed_when: > - opn1.failed or - not opn1.changed - - - name: Changing - ansibleguy.opnsense.unbound_dnsbl: - type: - - atf - whitelists: - - opnsense.org - - ansibleguy.net - blocklists: - - example.tor - wildcards: - - example.tor - nxdomain: true - enabled: true - register: opn2 - failed_when: > - opn2.failed or - not opn2.changed - - - name: Disabling 1 - ansibleguy.opnsense.unbound_dnsbl: - type: - - atf - whitelists: - - opnsense.org - - ansibleguy.net - blocklists: - - example.tor - wildcards: - - example.tor - nxdomain: true - enabled: false - reload: false # speed - register: opn3 - failed_when: > - opn3.failed or - not opn3.changed - when: not ansible_check_mode - - - name: Nothing changed - ansibleguy.opnsense.unbound_dnsbl: - type: - - atf - whitelists: - - opnsense.org - - ansibleguy.net - blocklists: - - example.tor - wildcards: - - example.tor - nxdomain: true - enabled: false - reload: false # speed - register: opn4 - failed_when: > - opn4.failed or - opn4.changed - when: not ansible_check_mode - - - name: Cleanup - ansibleguy.opnsense.unbound_dnsbl: - reload: false - when: not ansible_check_mode +--- + +- name: Testing Unbound DNS general settings + hosts: localhost + gather_facts: no + module_defaults: + group/ansibleguy.opnsense.all: + firewall: "{{ lookup('ansible.builtin.env', 'TEST_FIREWALL') }}" + api_credential_file: "{{ lookup('ansible.builtin.env', 'TEST_API_KEY') }}" + ssl_verify: false + + ansibleguy.opnsense.list: + target: 'unbound_dnsbl' + + tasks: + - name: Listing + ansibleguy.opnsense.list: + register: opn_pre1 + failed_when: > + opn_pre1.failed or + 'data' not in opn_pre1 + + - name: Configuring - failing because of invalid type + ansibleguy.opnsense.unbound_dnsbl: + type: + - ANSIBLE_TEST_1 + register: opn_fail1 + failed_when: not opn_fail1.failed + when: not ansible_check_mode + + - name: Configuring - failing because of invalid address + ansibleguy.opnsense.unbound_dnsbl: + address: INVALID + register: opn_fail2 + failed_when: not opn_fail2.failed + when: not ansible_check_mode + + - name: Reset Configuring + ansibleguy.opnsense.unbound_dnsbl: + when: not ansible_check_mode + + - name: Configuring + ansibleguy.opnsense.unbound_dnsbl: + type: + - atf + lists: ['https://example.com/dns.blocklist'] + whitelists: + - opnsense.org + - ansibleguy.net + blocklists: + - example.tor + wildcards: + - example.tor + address: 192.168.255.255 + nxdomain: false + enabled: true + register: opn1 + failed_when: > + opn1.failed or + not opn1.changed + + - name: Changing + ansibleguy.opnsense.unbound_dnsbl: + type: + - atf + whitelists: + - opnsense.org + - ansibleguy.net + blocklists: + - example.tor + wildcards: + - example.tor + nxdomain: true + enabled: true + register: opn2 + failed_when: > + opn2.failed or + not opn2.changed + + - name: Disabling 1 + ansibleguy.opnsense.unbound_dnsbl: + type: + - atf + whitelists: + - opnsense.org + - ansibleguy.net + blocklists: + - example.tor + wildcards: + - example.tor + nxdomain: true + enabled: false + reload: false # speed + register: opn3 + failed_when: > + opn3.failed or + not opn3.changed + when: not ansible_check_mode + + - name: Nothing changed + ansibleguy.opnsense.unbound_dnsbl: + type: + - atf + whitelists: + - opnsense.org + - ansibleguy.net + blocklists: + - example.tor + wildcards: + - example.tor + nxdomain: true + enabled: false + reload: false # speed + register: opn4 + failed_when: > + opn4.failed or + opn4.changed + when: not ansible_check_mode + + - name: Cleanup + ansibleguy.opnsense.unbound_dnsbl: + reload: false + when: not ansible_check_mode