pve_auth: fix groups + enabled

This commit is contained in:
jeltz 2023-04-05 23:27:11 +02:00
parent 8f51a2fb80
commit 1978f12794
Signed by: jeltz
GPG key ID: 800882B66C0C3326
2 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,5 @@
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
{% for name, user in pve_auth__users.items() %} {% for name, user in pve_auth__users.items() %}
{% if user.enabled | default(True) %}
{{ name }}:{{ user.password }}: {{ name }}:{{ user.password }}:
{% endif %}
{% endfor %} {% endfor %}

View file

@ -1,15 +1,17 @@
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
{% for name, user in pve_auth__users.items() %} {% for name, user in pve_auth__users.items() %}
{% if user.enabled | default(True) %} {% set enabled = user.enabled | default(True) %}
user:{{ name }}@pve:1:0:::::: user:{{ name }}@pve:{{ enabled | ternary(1, 0) }}:0::::::
{% endif %}
{% endfor %} {% endfor %}
{% for group in pve_auth__groups.keys() %} {% for group in pve_auth__groups.keys() %}
{% set users = pve_auth__users {% set users = pve_auth__users
| selectattr("groups", "defined") | dict2items
| selectattr("groups", "contains", group) %} | selectattr("value.groups", "defined")
| selectattr("value.groups", "contains", group)
| map(attribute="key")
| map("suffix", "@pve") %}
group:{{ group }}:{{ users | join(",") }}:: group:{{ group }}:{{ users | join(",") }}::
{% endfor %} {% endfor %}