summaryrefslogtreecommitdiffstats
path: root/roles/ands_idm/tasks/setup_dns.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/ands_idm/tasks/setup_dns.yml')
-rw-r--r--roles/ands_idm/tasks/setup_dns.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/ands_idm/tasks/setup_dns.yml b/roles/ands_idm/tasks/setup_dns.yml
new file mode 100644
index 0000000..a463c77
--- /dev/null
+++ b/roles/ands_idm/tasks/setup_dns.yml
@@ -0,0 +1,38 @@
+- name: "Find NM connection"
+ include_tasks: "find_ands_connection.yml"
+
+- name: "Change FQDN"
+ replace: path="/etc/hostname" regexp="{{ public_domain }}" replace="{{ ands_domain }}"
+
+- name: "Read FQDN"
+ command: "cat /etc/hostname"
+ register: hostname
+ changed_when: false
+
+- name: "Adjust runtime FQDN"
+ hostname: name="{{ hostname.stdout }}"
+
+- name: "Find configured DNS servers"
+ shell: "nmcli d show {{ ands_network_interface }} | grep DNS | grep {{ ands_idm_server_ip | quote }}"
+ register: dns_check
+ changed_when: dns_check is failed
+ failed_when: false
+
+- name: "Change DNS server on {{ ands_network_connection }}"
+# nmcli: conn_name="{{ ands_network_connection }}" dns4="[{{ ands_idm_server_ip }}]" state="present"
+ command: "nmcli connection modify {{ ands_network_connection | quote }} ipv4.dns {{ ands_idm_server_ip }} ipv4.ignore-auto-dns yes ipv6.ignore-auto-dns yes ipv4.dns-search '{{ ands_domain,public_search_domains }}'"
+ register: result
+ when:
+ - ands_network_connection is defined
+ - dns_check.rc != 0
+
+- name: "Update associated interface {{ ands_network_interface }}"
+ command: "nmcli connection up {{ ands_network_connection | quote }}"
+ when:
+ - ands_network_interface is defined
+ - result is changed
+
+
+
+#- name: Register idM in /etc/hosts
+# lineinfile: dest="/etc/hosts" line="192.168.26.212 ipeidm.ands.kit.edu ipeidm" regexp="ipeidm$" state="present"