diff --git a/defaults/main.yml b/defaults/main.yml index c8d9a89..6e81ee2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,6 @@ --- +# deploy custom /etc/nsswitch.conf config +avahi__configure_nsswitch: true + # should we do a version check? (recomended) submodules_versioncheck: false diff --git a/tasks/main.yml b/tasks/main.yml index 737700c..c381ffe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,3 +11,7 @@ - name: install mdns requirements ansible.builtin.include_tasks: install.yml + +- name: configure /etc/nsswitch.conf + ansible.builtin.include_tasks: nsswitch.yml + when: avahi__configure_nsswitch | bool diff --git a/tasks/nsswitch.yml b/tasks/nsswitch.yml new file mode 100644 index 0000000..5981771 --- /dev/null +++ b/tasks/nsswitch.yml @@ -0,0 +1,9 @@ +--- +- name: deploy /etc/nsswitch.conf + become: true + ansible.builtin.template: + src: 'templates/nsswitch.conf.j2' + dest: '/etc/nsswitch.conf' + owner: 'root' + group: 'root' + mode: 0644 diff --git a/templates/nsswitch.conf.j2 b/templates/nsswitch.conf.j2 new file mode 100644 index 0000000..dbbc48d --- /dev/null +++ b/templates/nsswitch.conf.j2 @@ -0,0 +1,23 @@ +# /etc/nsswitch.conf +# {{ ansible_managed }} +# +# Example configuration of GNU Name Service Switch functionality. +# If you have the `glibc-doc-reference' and `info' packages installed, try: +# `info libc "Name Service Switch"' for information about this file. + +passwd: files systemd +group: files [SUCCESS=merge] systemd +shadow: files +gshadow: files + +publickey: files + +hosts: files mymachines myhostname {{ avahi__mdns_name }} [NOTFOUND=return] resolve [!UNAVAIL=return] dns +networks: nis [NOTFOUND=return] files + +protocols: nis [NOTFOUND=return] db [NOTFOUND=return] files +services: nis [NOTFOUND=return] db [NOTFOUND=return] files +ethers: nis [NOTFOUND=return] db [NOTFOUND=return] files +rpc: nis [NOTFOUND=return] db [NOTFOUND=return] files + +netgroup: nis [NOTFOUND=return] files diff --git a/vars/Archlinux.yml b/vars/Archlinux.yml index a884c8e..b9d4225 100644 --- a/vars/Archlinux.yml +++ b/vars/Archlinux.yml @@ -3,3 +3,5 @@ avahi_packages: - avahi - mdns-scan - nss-mdns + +avahi__mdns_name: 'mdns_minimal' diff --git a/vars/Debian.yml b/vars/Debian.yml index 791e317..a32df45 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -3,3 +3,5 @@ avahi_packages: - 'avahi-discover' - 'avahi-utils' - 'mdns-scan' + +avahi__mdns_name: 'mdns4_minimal' diff --git a/vars/main.yml b/vars/main.yml index ddd38d1..c463502 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,4 +1,4 @@ --- # versionscheck -playbook_version_number: 3 +playbook_version_number: 4 playbook_version_path: 'do1jlr.avahi_client.version' diff --git a/vars/os_fallback.yml b/vars/os_fallback.yml index 4b6d3e0..5102265 100644 --- a/vars/os_fallback.yml +++ b/vars/os_fallback.yml @@ -1,3 +1,5 @@ --- avahi_packages: - mdns-scan + +avahi__mdns_name: 'mdns4_minimal'