X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=ansible%2Ftuer.yml;h=1ed9f12c8f2ec1ceb332be6512918e20fda7614b;hb=4582c57b9fe0d77f0997c08f471a1ae38c52377f;hp=dcfacab71d1af58c97f1d28edcc4da21352b39ef;hpb=55eac8aae5964353c4ed9b2391304b4a01dfa6c6;p=noc.git diff --git a/ansible/tuer.yml b/ansible/tuer.yml index dcfacab..1ed9f12 100644 --- a/ansible/tuer.yml +++ b/ansible/tuer.yml @@ -1,11 +1,51 @@ +--- - hosts: torwaechter connection: local + pre_tasks: + - name: Create go directories + file: + path: .cache/openwrt/tuer/{{ item }} + state: directory + with_items: [ gopath, gocache ] + + - 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: Download dependencies + command: go get -d ./... + args: + chdir: .cache/openwrt/tuer/door_and_sensors/{{ item }} + environment: + GOCACHE: "{{ playbook_dir }}/.cache/openwrt/tuer/gocache" + GOPATH: "{{ playbook_dir }}/.cache/openwrt/tuer/gopath" + with_items: [ door_client, door_daemon, update-keys ] + + - name: Cross-compile Go binaries + command: go build -ldflags "-s" + args: + chdir: .cache/openwrt/tuer/door_and_sensors/{{ item }} + environment: + GOCACHE: "{{ playbook_dir }}/.cache/openwrt/tuer/gocache" + GOPATH: "{{ playbook_dir }}/.cache/openwrt/tuer/gopath" + GO386: 387 + CGO_ENABLED: 0 + GOOS: linux + GOARCH: 386 + with_items: [ door_client, door_daemon, update-keys ] + roles: - role: openwrt-image delegate_to: localhost vars: openwrt_arch: x86 openwrt_target: geode + openwrt_output_image_suffixes: + - combined-ext4.img.gz + - combined-squashfs.img openwrt_packages_remove: - ppp - ppp-mod-pppoe @@ -23,3 +63,50 @@ - tcpdump openwrt_packages_extra: - git + + openwrt_mixin: + # Go binaries + /usr/local/bin/door_client: + mode: 0755 + file: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/door_client/door_client" + /usr/local/bin/door_daemon: + mode: 0755 + file: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/door_daemon/door_daemon" + /usr/local/bin/update-keys: + mode: 0755 + file: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/update-keys/update-keys" + + /etc/config/network: + content: | + config interface 'loopback' + option ifname 'lo' + option proto 'static' + option ipaddr '127.0.0.1' + option netmask '255.0.0.0' + + config globals 'globals' + option ula_prefix 'fdc9:e01f:83db::/48' + + config interface 'lan' + option ifname 'eth0' + option accept_ra '0' + option proto 'static' + option ipaddr '192.168.33.7' + option netmask '255.255.255.0' + option gateway '192.168.33.1' + option dns '192.168.33.1' + option dns_search 'realraum.at' + + /etc/config/dropbear: + content: | + config dropbear + option PasswordAuth 'off' + option RootPasswordAuth 'off' + option Port '22000' + + /etc/dropbear/authorized_keys: + mode: 0600 + content: |- + {% for key in noc_ssh_keys %} + {{ key }} + {% endfor %}