Role server-basic: use openresolv to set nameserver
This commit is contained in:
parent
84cc2ca1c8
commit
52d55e3997
4 changed files with 43 additions and 0 deletions
8
roles/server-basic/files/resolvconf.if-down
Normal file
8
roles/server-basic/files/resolvconf.if-down
Normal 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"
|
18
roles/server-basic/files/resolvconf.if-up
Normal file
18
roles/server-basic/files/resolvconf.if-up
Normal 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
|
|
@ -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
|
||||||
|
|
|
@ -9,6 +9,7 @@ packages:
|
||||||
- mlocate
|
- mlocate
|
||||||
- mosh
|
- mosh
|
||||||
- net-tools
|
- net-tools
|
||||||
|
- openresolv
|
||||||
- python-pip
|
- python-pip
|
||||||
- python3-yaml
|
- python3-yaml
|
||||||
- sysfsutils
|
- sysfsutils
|
||||||
|
|
Loading…
Reference in a new issue