Role server-basic: use openresolv to set nameserver

This commit is contained in:
Julian Labus 2019-03-23 14:59:12 +01:00
parent 84cc2ca1c8
commit 52d55e3997
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A
4 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,8 @@
#!/bin/sh
# ifdown hook script for resolvconf
# Written by Roy Marples <roy@marples.name> under the BSD-2 license
[ -x /sbin/resolvconf ] || exit 0
[ "$METHOD" = dhcp ] && /sbin/resolvconf -f -d "$IFACE"
/sbin/resolvconf -f -d "$IFACE"

View file

@ -0,0 +1,18 @@
#!/bin/sh
# ifup hook script for resolvconf
# Written by Roy Marples <roy@marples.name> under the BSD-2 license
[ -x /sbin/resolvconf ] || exit 0
conf=
[ -n "$IF_DNS_DOMAIN" ] && conf="${conf}domain $IF_DNS_DOMAIN\n"
[ -n "$IF_DNS_SEARCH" ] && conf="${conf}search $IF_DNS_SEARCH\n"
[ -n "$IF_DNS_SORTLIST" ] && conf="${conf}sortlist $IF_DNS_SORTLIST\n"
[ -n "$IF_DNS_OPTIONS" ] && conf="${conf}options $IF_DNS_OPTIONS\n"
for nameserver in $IF_DNS_NAMESERVERS; do
conf="${conf}nameserver $nameserver\n"
done
if [ -n "$conf" ]; then
conf="# Generated by ifup for $IFACE\n$conf"
printf "$conf" | /sbin/resolvconf -a "$IFACE"
fi

View file

@ -39,6 +39,22 @@
timezone: timezone:
name: Europe/Berlin name: Europe/Berlin
- name: copy resolvconf if-up
copy:
src: resolvconf.if-up
dest: /etc/network/if-up.d/000resolvconf
owner: root
group: root
mode: 0755
- name: copy resolvconf if-down
copy:
src: resolvconf.if-down
dest: /etc/network/if-down.d/resolvconf
owner: root
group: root
mode: 0755
- name: create ffmwu custom config dir - name: create ffmwu custom config dir
file: file:
path: /home/admin/.ffmwu-config path: /home/admin/.ffmwu-config

View file

@ -9,6 +9,7 @@ packages:
- mlocate - mlocate
- mosh - mosh
- net-tools - net-tools
- openresolv
- python-pip - python-pip
- python3-yaml - python3-yaml
- sysfsutils - sysfsutils