Merge PR#54: Friendly loop indexes when setting adduser options
[noc.git] / ansible / host_playbooks / torwaechter.yml
1 ---
2 - hosts: torwaechter
3   connection: local
4   pre_tasks:
5     - name: Create go directories
6       file:
7         path: "{{ global_cache_dir }}/{{ inventory_hostname }}/{{ item }}"
8         state: directory
9       with_items: [ gopath, gocache ]
10
11     - name: Clone necessary git repositories
12       git:
13         repo: https://github.com/realraum/{{ item }}.git
14         dest: "{{ global_cache_dir }}/{{ inventory_hostname }}/{{ item }}"
15         update: True
16       with_items: [ door_and_sensors ]
17
18     - name: Download dependencies
19       command: go get -d ./...
20       args:
21         chdir: "{{ global_cache_dir }}/{{ inventory_hostname }}/door_and_sensors/{{ item }}"
22       environment:
23         GOCACHE: "{{ global_cache_dir }}/{{ inventory_hostname }}/gocache"
24         GOPATH:  "{{ global_cache_dir }}/{{ inventory_hostname }}/gopath"
25       with_items: [ door_client, door_daemon, update-keys ]
26
27     - name: Cross-compile Go binaries
28       command: go build -ldflags "-s"
29       args:
30         chdir: "{{ global_cache_dir }}/{{ inventory_hostname }}/door_and_sensors/{{ item }}"
31       environment:
32         GOCACHE: "{{ global_cache_dir }}/{{ inventory_hostname }}/gocache"
33         GOPATH:  "{{ global_cache_dir }}/{{ inventory_hostname }}/gopath"
34         GO386: 387
35         CGO_ENABLED: 0
36         GOOS: linux
37         GOARCH: 386
38       with_items: [ door_client, door_daemon, update-keys ]
39
40   roles:
41     - role: openwrt/image
42       delegate_to: localhost