Compare commits
No commits in common. "dc0a3257fc1b13fc47439e5954ed5e633d7ad2a6" and "948c9a5d8d9aeb44db847b8ef8104aa21cbda1fd" have entirely different histories.
dc0a3257fc
...
948c9a5d8d
7 changed files with 15 additions and 93 deletions
|
@ -24,8 +24,6 @@ packages:
|
|||
- "ntpsec"
|
||||
- "haveged"
|
||||
- "haveged-openrc"
|
||||
- "git"
|
||||
- "git-lfs"
|
||||
templates:
|
||||
- "/etc/conf.d/iptables"
|
||||
- "/etc/conf.d/ip6tables"
|
||||
|
@ -40,8 +38,6 @@ templates:
|
|||
- "/etc/sysctl.d/coredump.conf"
|
||||
- "/etc/docker/daemon.json"
|
||||
- "/etc/ntp.conf"
|
||||
executables:
|
||||
- "/usr/libexec/ifupdown-ng/routes"
|
||||
services:
|
||||
- runlevel: "sysinit"
|
||||
service: "devfs"
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
dest: "/mnt{{ item }}"
|
||||
mode: "640"
|
||||
loop: "{{ templates }}"
|
||||
- name: "Also executables."
|
||||
template:
|
||||
src: "templates{{ item }}.j2"
|
||||
dest: "/mnt{{ item }}"
|
||||
mode: "750"
|
||||
loop: "{{ executables }}"
|
||||
- name: "And services."
|
||||
template:
|
||||
src: "templates{{ item }}.j2"
|
||||
|
|
|
@ -7,12 +7,6 @@
|
|||
dest: "{{ item }}"
|
||||
mode: "640"
|
||||
loop: "{{ templates }}"
|
||||
- name: "Also executables."
|
||||
template:
|
||||
src: "templates{{ item }}.j2"
|
||||
dest: "{{ item }}"
|
||||
mode: "750"
|
||||
loop: "{{ executables }}"
|
||||
- name: "And services."
|
||||
template:
|
||||
src: "templates{{ item }}.j2"
|
||||
|
|
|
@ -1,9 +1,20 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
command="/usr/sbin/ntpd"
|
||||
pidfile="/var/run/ntpd.pid"
|
||||
command_args="-g"
|
||||
DAEMON="/usr/sbin/ntpd"
|
||||
PIDFILE="/var/run/ntpd.pid"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting NTPSec"
|
||||
start-stop-daemon --start --exec "${DAEMON}" --pidfile "${PIDFILE}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping NTPSec"
|
||||
start-stop-daemon --stop --pidfile "${PIDFILE}"
|
||||
eend $?
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ auto eth0
|
|||
|
||||
iface eth0 inet static
|
||||
address {{ ansible_host }}/{{ netmask }}
|
||||
routes-static {{ gateway }},default via {{ gateway }}
|
||||
gateway {{ gateway }}
|
||||
|
||||
{% if ip6 is defined %}
|
||||
iface eth0 inet6 static
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# https://gist.github.com/jauderho/2ad0d441760fc5ed69d8d4e2d6b35f8d
|
||||
server time.cloudflare.com nts iburst
|
||||
driftfile /var/lib/ntp/ntp.drift
|
||||
file pidfile filename /var/run/ntpd.pid type pid
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
#!/bin/sh
|
||||
# https://github.com/ifupdown-ng/ifupdown-ng/issues/42#issuecomment-849135927
|
||||
[ -z "${VERBOSE}" ] || set -x
|
||||
|
||||
# routes-static 1.2.3.0/24,10.0.0.0/8 via 1.2.3.4
|
||||
# routes-rule dport 25 table 123,dport 587 table 123
|
||||
|
||||
# adds $3 to $1 if $1 does not contain $2
|
||||
addif() {
|
||||
if [ "$1" = "${1%$2*}" ]; then
|
||||
echo $1 $3
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
decidr() {
|
||||
echo "${1%/*}"
|
||||
}
|
||||
addsrc() {
|
||||
addif "$1" src "src $(decidr $IF_ADDRESS)"
|
||||
}
|
||||
adddev() {
|
||||
addif "$1" dev "dev $IFACE"
|
||||
}
|
||||
|
||||
# $1: input string
|
||||
# $2: delimeter
|
||||
# $3: function to call
|
||||
foreach() {
|
||||
list="$1"
|
||||
|
||||
while [ -n "$list" ]; do
|
||||
line="${list%%$2*}"
|
||||
list="${list#*$2}"
|
||||
"$3" "$line"
|
||||
|
||||
[ "$line" = "$list" ] && break
|
||||
done
|
||||
}
|
||||
|
||||
# add a route
|
||||
prep() {
|
||||
route="$1"
|
||||
route=$(addsrc "$route")
|
||||
route=$(adddev "$route")
|
||||
echo $route
|
||||
}
|
||||
routeadd() {
|
||||
${MOCK} ip route add $(prep "$1")
|
||||
}
|
||||
routedel() {
|
||||
${MOCK} ip route del $(prep "$1")
|
||||
}
|
||||
|
||||
ruleadd() {
|
||||
${MOCK} ip rule add $1
|
||||
}
|
||||
ruledel() {
|
||||
${MOCK} ip rule del $1
|
||||
}
|
||||
|
||||
case "$PHASE" in
|
||||
up)
|
||||
foreach "$IF_ROUTES_STATIC" , routeadd
|
||||
foreach "$IF_ROUTES_RULE" , ruleadd
|
||||
;;
|
||||
down)
|
||||
foreach "$IF_ROUTES_STATIC" , routedel
|
||||
foreach "$IF_ROUTES_RULE" , ruledel
|
||||
;;
|
||||
*) exit 0 ;;
|
||||
esac
|
Loading…
Reference in a new issue