File tree Expand file tree Collapse file tree 2 files changed +61
-19
lines changed Expand file tree Collapse file tree 2 files changed +61
-19
lines changed Original file line number Diff line number Diff line change @@ -472,25 +472,32 @@ One realm should have the `default: 1` property to mark it as the default:
472
472
pve_domains_cfg:
473
473
- name: pam
474
474
type: pam
475
- comment: Linux PAM standard authentication
475
+ attributes:
476
+ comment: Linux PAM standard authentication
476
477
- name: pve
477
478
type: pve
478
- comment: Proxmox VE authentication server
479
- - name: AD
479
+ attributes:
480
+ comment: Proxmox VE authentication server
481
+ - name: ad
480
482
type: ad
481
- comment: Active Directory authentication
482
- domain: yourdomain.com
483
- server1: dc01.yourdomain.com
484
- default: 1
485
- secure: 1
486
- server2: dc02.yourdomain.com
487
- - name: LDAP
483
+ attributes:
484
+ comment: Active Directory authentication
485
+ domain: yourdomain.com
486
+ server1: dc01.yourdomain.com
487
+ default: 1
488
+ secure: 1
489
+ server2: dc02.yourdomain.com
490
+ - name: ldap
488
491
type: ldap
489
- base_dn: CN=Users,dc=yourdomain,dc=com
490
- server1: ldap1.yourdomain.com
491
- user_attr: uid
492
- secure: 1
493
- server2: ldap2.yourdomain.com
492
+ attributes:
493
+ comment: LDAP authentication
494
+ base_dn: CN=Users,dc=yourdomain,dc=com
495
+ bind_dn: "uid=svc-reader,CN=Users,dc=yourdomain,dc=com"
496
+ bind_password: "{{ secret_ldap_svc_reader_password }}"
497
+ server1: ldap1.yourdomain.com
498
+ user_attr: uid
499
+ secure: 1
500
+ server2: ldap2.yourdomain.com
494
501
```
495
502
496
503
## Dependencies
Original file line number Diff line number Diff line change 22
22
content : |
23
23
{% for domain in pve_domains_cfg %}
24
24
{{ domain.type }}: {{ domain.name }}
25
- {% for k,v in domain.items() %}
26
- {% if k != 'name' %}
27
- {% if k != 'type ' %}
25
+ {% if domain.attributes %}
26
+ {% for k,v in domain.attributes.items() %}
27
+ {% if k != 'bind_password ' %}
28
28
{{ k }} {{ v }}
29
29
{% endif %}
30
- {% endif %}
31
30
{% endfor %}
31
+ {% endif %}
32
32
33
33
{% endfor %}
34
+
35
+ - name : Select ldap-based realms with bind_password
36
+ set_fact :
37
+ pve_ldap_realms_with_bind_pw : |
38
+ {{ pve_domains_cfg | selectattr('type', 'in', ['ad', 'ldap'])
39
+ | selectattr('attributes.bind_password', 'defined') }}
40
+
41
+ - name : Ensure /etc/pve/priv/realm/ exists
42
+ ansible.builtin.file :
43
+ path : /etc/pve/priv/realm
44
+ state : directory
45
+ owner : root
46
+ group : www-data
47
+ mode : 0700
48
+ when : pve_ldap_realms_with_bind_pw | length
49
+
50
+ - name : Ensure ldap-based realm secret files exists
51
+ ansible.builtin.file :
52
+ path : " /etc/pve/priv/realm/{{ item.name }}.pw"
53
+ access_time : preserve
54
+ modification_time : preserve
55
+ state : touch
56
+ mode : 0600
57
+ with_items :
58
+ - " {{ pve_ldap_realms_with_bind_pw }}"
59
+
60
+ - name : Update ldap-based realm secret files
61
+ ansible.builtin.copy :
62
+ content : " {{ item.attributes.bind_password }}"
63
+ dest : " /etc/pve/priv/realm/{{ item.name }}.pw"
64
+ owner : root
65
+ group : www-data
66
+ mode : 0600
67
+ with_items :
68
+ - " {{ pve_ldap_realms_with_bind_pw }}"
You can’t perform that action at this time.
0 commit comments