mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-08 14:23:11 +00:00
This fixes reporting errors on dnsconfig module and add some tests to verify that invalid IP addresses cannot be used as forwarders.
181 lines
4.7 KiB
YAML
181 lines
4.7 KiB
YAML
---
|
|
- name: Test dnsconfig
|
|
hosts: ipaserver
|
|
become: true
|
|
gather_facts: true
|
|
|
|
tasks:
|
|
# Setup.
|
|
- name: Ensure forwarders are absent.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
- ip_address: 8.8.4.4
|
|
- ip_address: 2001:4860:4860::8888
|
|
- ip_address: 2001:4860:4860::8888
|
|
port: 53
|
|
state: absent
|
|
|
|
# Tests.
|
|
- name: Set config to invalid IPv4.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 1.2.3.500
|
|
register: result
|
|
failed_when: not result.failed or "Invalid IP for DNS forwarder" not in result.msg
|
|
|
|
- name: Set config to invalid IP.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 1.in.va.lid
|
|
register: result
|
|
failed_when: not result.failed or "Invalid IP for DNS forwarder" not in result.msg
|
|
|
|
- name: Set config to invalid IPv6.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: fd00::invalid
|
|
register: result
|
|
failed_when: not result.failed or "Invalid IP for DNS forwarder" not in result.msg
|
|
|
|
- name: Set dnsconfig.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
- ip_address: 8.8.4.4
|
|
- ip_address: 2001:4860:4860::8888
|
|
port: 53
|
|
forward_policy: only
|
|
allow_sync_ptr: yes
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Set dnsconfig, with the same values.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
- ip_address: 8.8.4.4
|
|
- ip_address: 2001:4860:4860::8888
|
|
port: 53
|
|
forward_policy: only
|
|
allow_sync_ptr: yes
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure forwarder is absent.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Ensure forwarder is absent, again.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Disable global forwarders.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forward_policy: none
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Disable global forwarders, again.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forward_policy: none
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Re-enable global forwarders.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forward_policy: first
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Re-enable global forwarders, again.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forward_policy: first
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Disable PTR record synchronization.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
allow_sync_ptr: no
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Disable PTR record synchronization, again.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
allow_sync_ptr: no
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Re-enable PTR record synchronization.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
allow_sync_ptr: yes
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
- name: Re-enable PTR record synchronization, again.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
allow_sync_ptr: yes
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
- name: Ensure all forwarders are absent.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
- ip_address: 8.8.4.4
|
|
- ip_address: 2001:4860:4860::8888
|
|
port: 53
|
|
state: absent
|
|
register: result
|
|
failed_when: not result.changed
|
|
|
|
|
|
- name: Ensure all forwarders are absent, again.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
- ip_address: 8.8.4.4
|
|
- ip_address: 2001:4860:4860::8888
|
|
port: 53
|
|
state: absent
|
|
register: result
|
|
failed_when: result.changed
|
|
|
|
# Cleanup.
|
|
- name: Ensure forwarders are absent.
|
|
ipadnsconfig:
|
|
ipaadmin_password: SomeADMINpassword
|
|
forwarders:
|
|
- ip_address: 8.8.8.8
|
|
- ip_address: 8.8.4.4
|
|
- ip_address: 2001:4860:4860::8888
|
|
- ip_address: 2001:4860:4860::8888
|
|
port: 53
|
|
state: absent
|