cd06649f6298d3758d807ea0f8e78076f9faf3ab
[noc.git] / ansible / tuer.yml
1 - hosts: torwaechter
2   connection: local
3   tasks:
4     - name: Create cache repository
5       file:
6         path: .cache/openwrt/tuer
7         state: directory
8
9     - name: Create GOPATH directory
10       file:
11         path: .cache/openwrt/tuer/gopath
12         state: directory
13
14     - name: Clone necessary git repositories
15       git:
16         repo: https://github.com/realraum/{{ item }}.git
17         dest: .cache/openwrt/tuer/{{ item }}
18         update: True
19       with_items: [ door_and_sensors ]
20
21 #    - name: Build update-keys
22
23     - name: Download dependencies
24       command: go get -d ./...
25       args:
26         chdir: .cache/openwrt/tuer/door_and_sensors/{{ item }}
27       environment:
28         GOPATH: "{{ playbook_dir }}/.cache/openwrt/tuer/gopath"
29       with_items: [ door_client, door_daemon ]
30
31     - name: Cross-compile Go binaries
32       command: go build -ldflags "-s"
33       args:
34         chdir: .cache/openwrt/tuer/door_and_sensors/{{ item }}
35       environment:
36         GO386: 387
37         CGO_ENABLED: 0
38         GOOS: linux
39         GOARCH: 386
40       with_items: [ door_client, door_daemon ]
41
42 - hosts: torwaechter
43   connection: local
44   roles:
45     - role: openwrt-image
46       delegate_to: localhost
47       vars:
48         openwrt_arch: x86
49         openwrt_target: geode
50         openwrt_packages_remove:
51           - ppp
52           - ppp-mod-pppoe
53           - dnsmasq
54           - firewall
55           - odhcpd
56         openwrt_packages_add:
57           - flashrom
58           - haveged
59           - htop
60           - hwclock
61           - ip
62           - less
63           - nano
64           - tcpdump
65         openwrt_packages_extra:
66           - git