mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-08-01 12:24:43 +00:00
ipadnsconfig: Separate tests for forwarders with custom ports.
Due to an issue with python-dns, FreeIPA is raising an expection when setting a DNS forwarder with a custom port. Separating the test for ipadnsconfig that use forwarders with custom allows the other tests to be correctly executed.
This commit is contained in:
@@ -13,14 +13,11 @@
|
|||||||
forwarders:
|
forwarders:
|
||||||
- ip_address: 8.8.8.8
|
- ip_address: 8.8.8.8
|
||||||
- ip_address: 8.8.4.4
|
- ip_address: 8.8.4.4
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
port: 53
|
|
||||||
state: absent
|
state: absent
|
||||||
action: member
|
action: member
|
||||||
|
|
||||||
# Tests.
|
# Tests.
|
||||||
- name: Set config to invalid IPv4.
|
- name: Set forward with invalid IPv4.
|
||||||
ipadnsconfig:
|
ipadnsconfig:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
@@ -54,8 +51,6 @@
|
|||||||
forwarders:
|
forwarders:
|
||||||
- ip_address: 8.8.8.8
|
- ip_address: 8.8.8.8
|
||||||
- ip_address: 8.8.4.4
|
- ip_address: 8.8.4.4
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
port: 53
|
|
||||||
forward_policy: only
|
forward_policy: only
|
||||||
allow_sync_ptr: yes
|
allow_sync_ptr: yes
|
||||||
register: result
|
register: result
|
||||||
@@ -68,8 +63,6 @@
|
|||||||
forwarders:
|
forwarders:
|
||||||
- ip_address: 8.8.8.8
|
- ip_address: 8.8.8.8
|
||||||
- ip_address: 8.8.4.4
|
- ip_address: 8.8.4.4
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
port: 53
|
|
||||||
forward_policy: only
|
forward_policy: only
|
||||||
allow_sync_ptr: yes
|
allow_sync_ptr: yes
|
||||||
register: result
|
register: result
|
||||||
@@ -97,14 +90,15 @@
|
|||||||
register: result
|
register: result
|
||||||
failed_when: result.changed or result.failed
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
- name: Ensure forwarder 8.8.4.4 is present.
|
- name: Check if forwarder 8.8.4.4 is present.
|
||||||
ipadnsconfig:
|
ipadnsconfig:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
forwarders:
|
forwarders:
|
||||||
- ip_address: 8.8.4.4
|
- ip_address: 8.8.4.4
|
||||||
|
check_mode: yes
|
||||||
register: result
|
register: result
|
||||||
failed_when: not result.changed or result.failed
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
- name: Ensure forwarder 8.8.8.8 is present.
|
- name: Ensure forwarder 8.8.8.8 is present.
|
||||||
ipadnsconfig:
|
ipadnsconfig:
|
||||||
@@ -115,35 +109,16 @@
|
|||||||
register: result
|
register: result
|
||||||
failed_when: not result.changed or result.failed
|
failed_when: not result.changed or result.failed
|
||||||
|
|
||||||
- name: Ensure forwarder 8.8.4.4 is present.
|
- name: Check forwarder 8.8.4.4 is still present.
|
||||||
ipadnsconfig:
|
ipadnsconfig:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
forwarders:
|
forwarders:
|
||||||
- ip_address: 8.8.4.4
|
- ip_address: 8.8.4.4
|
||||||
|
check_mode: yes
|
||||||
register: result
|
register: result
|
||||||
failed_when: not result.changed or result.failed
|
failed_when: not result.changed or result.failed
|
||||||
|
|
||||||
- name: Ensure forwarders are absent.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
register: result
|
|
||||||
failed_when: not result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure forwarders are absent, again.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
register: result
|
|
||||||
failed_when: result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Disable global forwarders.
|
- name: Disable global forwarders.
|
||||||
ipadnsconfig:
|
ipadnsconfig:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
@@ -208,97 +183,6 @@
|
|||||||
register: result
|
register: result
|
||||||
failed_when: result.changed or result.failed
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
- name: Ensure all forwarders are absent.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
port: 53
|
|
||||||
state: absent
|
|
||||||
action: member
|
|
||||||
register: result
|
|
||||||
failed_when: not result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure all forwarders are absent, again.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
port: 53
|
|
||||||
state: absent
|
|
||||||
action: member
|
|
||||||
register: result
|
|
||||||
failed_when: result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure forwarder is present.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
register: result
|
|
||||||
failed_when: not result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure forwarders is not present.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
check_mode: yes
|
|
||||||
register: result
|
|
||||||
failed_when: not result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure forwarders are present.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
action: member
|
|
||||||
register: result
|
|
||||||
failed_when: not result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure forwarders are present, again.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
action: member
|
|
||||||
register: result
|
|
||||||
failed_when: result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure another forwarder is present.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
action: member
|
|
||||||
register: result
|
|
||||||
failed_when: result.changed or result.failed
|
|
||||||
|
|
||||||
- name: Ensure forwarders are present.
|
|
||||||
ipadnsconfig:
|
|
||||||
ipaadmin_password: SomeADMINpassword
|
|
||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
|
||||||
forwarders:
|
|
||||||
- ip_address: 8.8.4.4
|
|
||||||
- ip_address: 8.8.8.8
|
|
||||||
action: member
|
|
||||||
register: result
|
|
||||||
failed_when: result.changed or result.failed
|
|
||||||
|
|
||||||
# Cleanup.
|
|
||||||
- name: Ensure forwarders are absent.
|
- name: Ensure forwarders are absent.
|
||||||
ipadnsconfig:
|
ipadnsconfig:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
@@ -306,8 +190,5 @@
|
|||||||
forwarders:
|
forwarders:
|
||||||
- ip_address: 8.8.8.8
|
- ip_address: 8.8.8.8
|
||||||
- ip_address: 8.8.4.4
|
- ip_address: 8.8.4.4
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
- ip_address: 2001:4860:4860::8888
|
|
||||||
port: 53
|
|
||||||
state: absent
|
state: absent
|
||||||
action: member
|
action: member
|
||||||
|
|||||||
81
tests/dnsconfig/test_dnsconfig_forwarders_ports.yml
Normal file
81
tests/dnsconfig/test_dnsconfig_forwarders_ports.yml
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
---
|
||||||
|
- name: Test dnsconfig forwarders with custom ports
|
||||||
|
hosts: "{{ ipa_test_host | default('ipaserver') }}"
|
||||||
|
become: true
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- block:
|
||||||
|
# Setup.
|
||||||
|
- name: Ensure forwarder with custom port is absent.
|
||||||
|
ipadnsconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
forwarders:
|
||||||
|
- ip_address: 2001:4860:4860::8888
|
||||||
|
port: 53
|
||||||
|
state: absent
|
||||||
|
action: member
|
||||||
|
|
||||||
|
# Tests.
|
||||||
|
|
||||||
|
- name: Ensure forwarder with custom port is present.
|
||||||
|
ipadnsconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
forwarders:
|
||||||
|
- ip_address: 2001:4860:4860::8888
|
||||||
|
port: 53
|
||||||
|
state: present
|
||||||
|
action: member
|
||||||
|
register: result
|
||||||
|
failed_when: not result.changed or result.failed
|
||||||
|
|
||||||
|
- name: Ensure forwarder with custom port is present, again.
|
||||||
|
ipadnsconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
forwarders:
|
||||||
|
- ip_address: 2001:4860:4860::8888
|
||||||
|
port: 53
|
||||||
|
state: present
|
||||||
|
action: member
|
||||||
|
register: result
|
||||||
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
|
- name: Ensure forwarder with custom port is absent.
|
||||||
|
ipadnsconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
forwarders:
|
||||||
|
- ip_address: 2001:4860:4860::8888
|
||||||
|
port: 53
|
||||||
|
state: absent
|
||||||
|
action: member
|
||||||
|
register: result
|
||||||
|
failed_when: not result.changed or result.failed
|
||||||
|
|
||||||
|
- name: Ensure forwarder with custom port is absent, again.
|
||||||
|
ipadnsconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
forwarders:
|
||||||
|
- ip_address: 2001:4860:4860::8888
|
||||||
|
port: 53
|
||||||
|
state: absent
|
||||||
|
action: member
|
||||||
|
register: result
|
||||||
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
|
always:
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
- name: Ensure forwarder with custom port is absent.
|
||||||
|
ipadnsconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
forwarders:
|
||||||
|
- ip_address: 2001:4860:4860::8888
|
||||||
|
port: 53
|
||||||
|
state: absent
|
||||||
|
action: member
|
||||||
Reference in New Issue
Block a user