From d00b456d24b9439c1a04d0a1b8b86aab4ef6fc61 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 22 Apr 2018 23:16:23 +0200 Subject: [PATCH] tuer: Build go binaries --- ansible/tuer.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/ansible/tuer.yml b/ansible/tuer.yml index dcfacab..cd06649 100644 --- a/ansible/tuer.yml +++ b/ansible/tuer.yml @@ -1,5 +1,46 @@ - hosts: torwaechter connection: local + tasks: + - name: Create cache repository + file: + path: .cache/openwrt/tuer + state: directory + + - name: Create GOPATH directory + file: + path: .cache/openwrt/tuer/gopath + state: directory + + - name: Clone necessary git repositories + git: + repo: https://github.com/realraum/{{ item }}.git + dest: .cache/openwrt/tuer/{{ item }} + update: True + with_items: [ door_and_sensors ] + +# - name: Build update-keys + + - name: Download dependencies + command: go get -d ./... + args: + chdir: .cache/openwrt/tuer/door_and_sensors/{{ item }} + environment: + GOPATH: "{{ playbook_dir }}/.cache/openwrt/tuer/gopath" + with_items: [ door_client, door_daemon ] + + - name: Cross-compile Go binaries + command: go build -ldflags "-s" + args: + chdir: .cache/openwrt/tuer/door_and_sensors/{{ item }} + environment: + GO386: 387 + CGO_ENABLED: 0 + GOOS: linux + GOARCH: 386 + with_items: [ door_client, door_daemon ] + +- hosts: torwaechter + connection: local roles: - role: openwrt-image delegate_to: localhost -- 1.7.10.4