mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 20:04:45 +00:00
ipaclient: Configure DNS resolver
The configuration of the DNS resolver is useful if the IPA server has internal DNS support. The installation of packages is happening before the DNS resolver is configured, therefore package installation needs to be possible without the configuration of the DNS resolver. The DNS nameservers are configured for `NetworkManager`, `systemd-resolved` (if installed and enabled) and `/etc/resolv.conf` if neither NetworkManager nor systemd-resolved is used. Example inventory: [ipaserver] ipaserver.example.com [ipaclients] ipaclient1.example.com [ipaclients:vars] ipaadmin_principal=admin ipaadmin_password=MySecretPassword123 ipaclient_domain=example.com ipaclient_configure_dns_resolver=yes ipaclient_dns_servers=192.168.100.1 ipaclient_cleanup_dns_resolver=yes New parameters: ipaclient_configure_dns_resolver The bool value defines if the DNS resolver is configured. before deploying the client. This is useful if the IPA server has internal DNS support. ipaclient_dns_server need to be set also. ipaclient_dns_servers The list of DNS server IP addresses. This is only useful with ipaclient_configure_dns_resolver. ipaclient_cleanup_dns_resolver The bool value defines if DNS resolvers that have been configured before with ipaclient_configure_dns_resolver will be cleaned up again. New module: roles/ipaclient/library/ipaclient_configure_dns_resolver.py Fixes: #902 (Consider adding support for client DNS resolver configuration)
This commit is contained in:
@@ -27,6 +27,25 @@
|
||||
ipaadmin_principal: admin
|
||||
when: ipaadmin_principal is undefined and ipaclient_keytab is undefined
|
||||
|
||||
- name: Install - Configure DNS resolver Block
|
||||
block:
|
||||
|
||||
- name: Install - Fail on missing ipaclient_domain and ipaserver_domain
|
||||
fail: msg="ipaclient_domain or ipaserver_domain is required for ipaclient_configure_dns_resolver"
|
||||
when: ipaserver_domain is not defined and ipaclient_domain is not defined
|
||||
|
||||
- name: Install - Fail on missing ipaclient_servers
|
||||
fail: msg="ipaclient_dns_servers is required for ipaclient_configure_dns_resolver"
|
||||
when: ipaclient_dns_servers is not defined
|
||||
|
||||
- name: Install - Configure DNS resolver
|
||||
ipaclient_configure_dns_resolver:
|
||||
nameservers: "{{ ipaclient_dns_servers }}"
|
||||
searchdomains: "{{ ipaserver_domain | default(ipaclient_domain) }}"
|
||||
state: present
|
||||
|
||||
when: ipaclient_configure_dns_resolver
|
||||
|
||||
- name: Install - IPA client test
|
||||
ipaclient_test:
|
||||
### basic ###
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
failed_when: uninstall.rc != 0 and uninstall.rc != 2
|
||||
changed_when: uninstall.rc == 0
|
||||
|
||||
- name: Uninstall - Unconfigure DNS resolver
|
||||
ipaclient_configure_dns_resolver:
|
||||
state: absent
|
||||
when: ipaclient_cleanup_dns_resolver | bool
|
||||
|
||||
#- name: Remove IPA client package
|
||||
# package:
|
||||
# name: "{{ ipaclient_packages }}"
|
||||
|
||||
Reference in New Issue
Block a user