From b9eed9f4a3376e44083862e19f6ab8d8295dbdcc Mon Sep 17 00:00:00 2001 From: Kridsada Thanabulpong Date: Thu, 5 Dec 2019 22:57:53 +0900 Subject: [PATCH] [doh-server] update to 2.2.1 --- roles/doh-server/defaults/main.yml | 2 -- roles/doh-server/tasks/main.yml | 35 ++++++++++++------- roles/doh-server/templates/doh-server.conf.j2 | 1 - 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/roles/doh-server/defaults/main.yml b/roles/doh-server/defaults/main.yml index 730ce20..09aaac9 100644 --- a/roles/doh-server/defaults/main.yml +++ b/roles/doh-server/defaults/main.yml @@ -7,8 +7,6 @@ doh_server_logger: | doh_server_retries: 3 -doh_server_tcp_only: false - doh_server_timeout: 10 doh_server_upstream: diff --git a/roles/doh-server/tasks/main.yml b/roles/doh-server/tasks/main.yml index d63b93d..d168ba1 100644 --- a/roles/doh-server/tasks/main.yml +++ b/roles/doh-server/tasks/main.yml @@ -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 ## diff --git a/roles/doh-server/templates/doh-server.conf.j2 b/roles/doh-server/templates/doh-server.conf.j2 index 9aad23e..28119de 100644 --- a/roles/doh-server/templates/doh-server.conf.j2 +++ b/roles/doh-server/templates/doh-server.conf.j2 @@ -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"}} -- 2.45.2