- 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"