M roles/doh-server/defaults/main.yml => roles/doh-server/defaults/main.yml +0 -2
@@ 7,8 7,6 @@ doh_server_logger: |
doh_server_retries: 3
-doh_server_tcp_only: false
-
doh_server_timeout: 10
doh_server_upstream:
M roles/doh-server/tasks/main.yml => roles/doh-server/tasks/main.yml +22 -13
@@ 2,16 2,15 @@
## Install
##
-- name: install
+- name: install doh-server
become: yes
pkgng:
name:
- - git-lite
+ - curl
- gmake
- go
state: latest
-
## Configure
##
@@ 24,7 23,6 @@
group: wheel
mode: 0755
-
- name: configure doh-server
become: yes
template:
@@ 33,25 31,37 @@
notify:
- restart doh-server
-
## Setup
##
- name: install doh-server
become: yes
shell: |
- BUILD_BASE="$(mktemp -d)"
- SRCDIR="$BUILD_BASE/src"
- GOPATH="$BUILD_BASE/gopath"
+ BUILD_BASE=$(mktemp -d)
+ SRCDIR=$BUILD_BASE/src
+ GOPATH=$BUILD_BASE/gopath
trap 'rm -rf $BUILD_BASE' 0 1 2 3 6 14 15
- git clone https://github.com/m13253/dns-over-https.git "$SRCDIR"
+ VERSION=2.2.1
+ DIST_URL=https://github.com/m13253/dns-over-https/archive/v${VERSION}.tar.gz
+
+ if [ -f /usr/local/bin/doh-server ]; then
+ INSTALLED_VER=$(doh-server --version | awk '/doh-server/ { print $2 }')
+ if [ "$INSTALLED_VER" = "$VERSION" ]; then
+ exit 128
+ fi
+ fi
+
+ mkdir -p "$SRCDIR"
+ curl -sSL "$DIST_URL" | tar -C "$SRCDIR" -xzf - --strip-components=1
cd "$SRCDIR" || exit 1
gmake || exit 1
install -m0755 doh-server/doh-server /usr/local/bin/doh-server
- args:
- creates: /usr/local/bin/doh-server
-
+ register: doh_bootstrap
+ failed_when: doh_bootstrap.rc != 0 and doh_bootstrap.rc != 128
+ changed_when: doh_bootstrap.rc != 128
+ notify:
+ - restart doh-server
## Supervise
##
@@ 89,7 99,6 @@
- rescan s6
- restart doh-server logger
-
## Per-role flush
##
M roles/doh-server/templates/doh-server.conf.j2 => roles/doh-server/templates/doh-server.conf.j2 +0 -1
@@ 16,5 16,4 @@ upstream = [
timeout = {{doh_server_timeout}}
tries = {{doh_server_retries}}
-tcp_only = {{"true" if doh_server_tcp_only else "false"}}
verbose = {{"true" if doh_server_verbose else "false"}}