summaryrefslogtreecommitdiff
path: root/roles/installer/openwrt/image/templates
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-04-28 18:46:49 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-04-28 18:46:49 +0200
commit2ccdc4546d38ed0e9d6784668168c4d566311f6f (patch)
treef7893ea03c648e63a1ace6388b2ab0162b1861a6 /roles/installer/openwrt/image/templates
parentupdate prometheus exporter ssl and chrony (diff)
move raspios and openwrt folders to installer/
Diffstat (limited to 'roles/installer/openwrt/image/templates')
-rw-r--r--roles/installer/openwrt/image/templates/group.j221
-rw-r--r--roles/installer/openwrt/image/templates/passwd.j29
-rw-r--r--roles/installer/openwrt/image/templates/uci.j215
3 files changed, 45 insertions, 0 deletions
diff --git a/roles/installer/openwrt/image/templates/group.j2 b/roles/installer/openwrt/image/templates/group.j2
new file mode 100644
index 00000000..cb433b88
--- /dev/null
+++ b/roles/installer/openwrt/image/templates/group.j2
@@ -0,0 +1,21 @@
+{{ ansible_managed | comment }}
+root:x:0:
+daemon:x:1:
+adm:x:4:
+mail:x:8:
+audio:x:29:
+www-data:x:33:
+ftp:x:55:
+users:x:100:
+network:x:101:
+{% for name, opt in openwrt_users.items() %}
+{% if 'group_id' not in opt %}
+{{ 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/roles/installer/openwrt/image/templates/passwd.j2 b/roles/installer/openwrt/image/templates/passwd.j2
new file mode 100644
index 00000000..9beaeb61
--- /dev/null
+++ b/roles/installer/openwrt/image/templates/passwd.j2
@@ -0,0 +1,9 @@
+{{ ansible_managed | comment }}
+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 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/roles/installer/openwrt/image/templates/uci.j2 b/roles/installer/openwrt/image/templates/uci.j2
new file mode 100644
index 00000000..3cc480b2
--- /dev/null
+++ b/roles/installer/openwrt/image/templates/uci.j2
@@ -0,0 +1,15 @@
+{{ ansible_managed | comment }}
+
+{% for section in item.value %}
+config {{ section.name }}
+{% for option, value in section.options.items() %}
+{% if value is iterable and value is not string %}
+{% for v in value %}
+ list {{ option }} '{{ v }}'
+{% endfor %}
+{% else %}
+ option {{ option }} '{{ value }}'
+{% endif %}
+{% endfor %}
+
+{% endfor %}