From: nicoo Date: Wed, 16 May 2018 20:58:51 +0000 (+0200) Subject: fixup! roles/openwrt-image: Support creating users/groups X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=f604840d31f25d2173cd8a75b494628585f14df6;p=noc.git fixup! roles/openwrt-image: Support creating users/groups --- diff --git a/ansible/roles/openwrt-image/group.j2 b/ansible/roles/openwrt-image/group.j2 index 850e5da..cb433b8 100644 --- a/ansible/roles/openwrt-image/group.j2 +++ b/ansible/roles/openwrt-image/group.j2 @@ -13,7 +13,9 @@ network:x:101: {{ name }}:x:{{ opt.id | default(loop.index + 110) }}: {% endif %} {% endfor %} +{% if openwrt_groups is defined %} {% for name, opt in openwrt_groups.items() %} {{ name }}:x:{{ opt.id | default(loop.index + 200) }}: {% endfor %} +{% endif %} nogroup:x:65534: diff --git a/ansible/roles/openwrt-image/passwd.j2 b/ansible/roles/openwrt-image/passwd.j2 index 5a24840..9beaeb6 100644 --- a/ansible/roles/openwrt-image/passwd.j2 +++ b/ansible/roles/openwrt-image/passwd.j2 @@ -3,7 +3,7 @@ root:x:0:0:root:/root:/bin/ash daemon:*:1:1:daemon:/var:/bin/false ftp:*:55:55:ftp:/home/ftp:/bin/false network:*:101:101:network:/var:/bin/false -{% for user in openwrt_users %} -{{ user.name }}:*:{{ user.id | default(loop.index + 110) }}:{{ user.gid | default(loop.index + 110) }}:{{ user.name }}:{{ user.home | default('/nonexistent') }}:{{ user.shell | default('/bin/false') }} +{% for name, opt in openwrt_users.items() %} +{{ name }}:*:{{ opt.id | default(loop.index + 110) }}:{{ opt.gid | default(loop.index + 110) }}:{{ name }}:{{ opt.home | default('/nonexistent') }}:{{ opt.shell | default('/bin/false') }} {% endfor %} nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/ansible/roles/openwrt-image/tasks/prepare.yml b/ansible/roles/openwrt-image/tasks/prepare.yml index 34ef456..e049983 100644 --- a/ansible/roles/openwrt-image/tasks/prepare.yml +++ b/ansible/roles/openwrt-image/tasks/prepare.yml @@ -72,7 +72,7 @@ dest: "{{ openwrt_imgbuilder_files }}/etc/group" mode: 0644 trim_blocks: yes - when: openwrt_groups or openwrt_users is defined + when: openwrt_groups is defined or openwrt_users is defined ### TODO: this just hangs? # - unarchive: