From 3751b141f2abac4c5e2d188846966bef7d4f3eff Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 6 May 2018 13:38:40 +0200 Subject: [PATCH] roles/openwrt-image: Refactor openwrt-mixins --- ansible/roles/openwrt-image/tasks/prepare.yml | 11 ++++++----- ansible/tuer.yml | 24 ++++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ansible/roles/openwrt-image/tasks/prepare.yml b/ansible/roles/openwrt-image/tasks/prepare.yml index 30cd32b..056daf3 100644 --- a/ansible/roles/openwrt-image/tasks/prepare.yml +++ b/ansible/roles/openwrt-image/tasks/prepare.yml @@ -13,14 +13,14 @@ state: directory with_items: - "{{ openwrt_imgbuilder_files }}" - - "{{ openwrt_mixin.files | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}" - - "{{ openwrt_mixin.content | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}" + - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}" - name: Copy mixins in place [1/2] copy: - src: "{{ item.value }}" + src: "{{ item.file }}" dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}" - with_dict: "{{ openwrt_mixin.files }}" + with_dict: "{{ openwrt_mixin }}" + when: '"file" in item' loop_control: label: "{{ item.key }}" @@ -28,7 +28,8 @@ copy: content: "{{ item.value }}" dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}" - with_dict: "{{ openwrt_mixin.content }}" + with_dict: "{{ openwrt_mixin }}" + when: '"content" in item' loop_control: label: "{{ item.key }}" diff --git a/ansible/tuer.yml b/ansible/tuer.yml index db757c5..9989e0d 100644 --- a/ansible/tuer.yml +++ b/ansible/tuer.yml @@ -65,14 +65,16 @@ - git openwrt_mixin: - files: - # Go binaries - /usr/local/bin/door_client: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/door_client/door_client" - /usr/local/bin/door_daemon: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/door_daemon/door_daemon" - /usr/local/bin/update-keys: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/update-keys/update-keys" + # Go binaries + /usr/local/bin/door_client: + file: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/door_client/door_client" + /usr/local/bin/door_daemon: + file: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/door_daemon/door_daemon" + /usr/local/bin/update-keys: + file: "{{ playbook_dir }}/.cache/openwrt/tuer/door_and_sensors/update-keys/update-keys" - content: - /etc/config/network: | + /etc/config/network: + content: | config interface 'loopback' option ifname 'lo' option proto 'static' @@ -92,14 +94,16 @@ option dns '192.168.33.1' option dns_search 'realraum.at' - /etc/config/dropbear: | + /etc/config/dropbear: + content: | config dropbear option PasswordAuth 'off' option RootPasswordAuth 'off' option Port '22000' - # TODO: mode needs to be 0600 - /etc/dropbear/authorized_keys: |- + # TODO: mode needs to be 0600 + /etc/dropbear/authorized_keys: + content: |- {% for key in noc_ssh_keys %} {{ key }} {% endfor %} -- 1.7.10.4