]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Adding and using roles/389ds-config-plugins/tasks/attr-uniq.yaml
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 3 Dec 2024 16:22:23 +0000 (17:22 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 3 Dec 2024 16:22:23 +0000 (17:22 +0100)
13 files changed:
inventory/dpx-ldap-dev1.yaml
inventory/spk-ldap-stage.yaml
roles/389ds-config-logging/defaults/main.yaml [new file with mode: 0644]
roles/389ds-config-logging/vars/main.yaml [deleted file]
roles/389ds-config-plugins/defaults/main.yaml [new file with mode: 0644]
roles/389ds-config-plugins/tasks/attr-uniq.yaml [new file with mode: 0644]
roles/389ds-config-plugins/tasks/main.yaml
roles/389ds-config-plugins/tasks/referint.yaml
roles/389ds-config-plugins/vars/main.yaml [deleted file]
roles/389ds-restart/defaults/main.yaml [new file with mode: 0644]
roles/389ds-restart/vars/main.yaml [deleted file]
roles/haproxy-disable-backend/defaults/main.yaml [new file with mode: 0644]
roles/haproxy-disable-backend/vars/main.yaml [deleted file]

index 4c8a95e014f849345dd9e2bbd9b4eff6ad1a5bb7..d63b43c0967b7c358047e5fe645c2da57a7a5f8a 100644 (file)
@@ -27,4 +27,34 @@ all:
     haproxy_backend_name: 'be-ldap-dev1'
     haproxy_user_socket: '/run/haproxy/user.sock'
     haproxy_admin_socket: '/run/haproxy/admin.sock'
+    # ds389_plugin_attr_uniq_purge: false
+    ds389_plugin_attr_uniq_attributes:
+      'uid':
+        across_all_subtrees: false
+        subtrees:
+          - 'o=bmas,o=isp'
+          - 'o=bmf,o=isp'
+          - 'o=BMWA,o=isp'
+          - 'o=bmwi,o=isp'
+          - 'o=bmwi-unternehmergeist,o=isp'
+          - 'o=cosTemplates,o=isp'
+          - 'o=Internet,o=isp'
+          - 'o=mbvd,o=isp'
+          - 'o=pfizer,o=isp'
+          - 'o=Pixelpark,o=isp'
+          - 'o=publicis,o=isp'
+          - 'o=PuF,o=isp'
+          - 'o=Radeberger,o=isp'
+          - 'o=sirona,o=isp'
+          - 'o=tov,o=isp'
+      'gidNumber':
+        subtrees:
+          - 'o=isp'
+      'mail':
+        subtrees:
+          - 'o=isp'
+      'uidNumber':
+        subtrees:
+          - 'o=isp'
 
+# vim: filetype=yaml
index f371d788eeb4a93282618e0353b0449a854645cd..13ac24c87aa4e720634f82fcdcea140cfe73699e 100644 (file)
@@ -24,5 +24,12 @@ all:
     haproxy_backend_name: 'be-stage-ldap'
     haproxy_user_socket: '/run/haproxy/user.sock'
     haproxy_admin_socket: '/run/haproxy/admin.sock'
+    ds389_plugin_attr_uniq_config: false
+    # ds389_plugin_attr_uniq_purge: false
+    ds389_plugin_attr_uniq_attributes:
+      'uid':
+        across_all_subtrees: false
+        subtrees:
+          - 'dc=spk,dc=pixelpark,dc=net'
 
 # vim: filetype=yaml
diff --git a/roles/389ds-config-logging/defaults/main.yaml b/roles/389ds-config-logging/defaults/main.yaml
new file mode 100644 (file)
index 0000000..acdd7d7
--- /dev/null
@@ -0,0 +1,21 @@
+---
+base_logdir: '/var/log/dirsrv'
+
+logging:
+  access:
+    logfile: access.log
+    enabled: true
+  audit:
+    logfile: audit.log
+    enabled: false
+  auditfail:
+    logfile: audit.log
+    enabled: true
+  error:
+    logfile: error.log
+    enabled: true
+  security:
+    logfile: security.log
+    enabled: true
+
+# vim: filetype=yaml
diff --git a/roles/389ds-config-logging/vars/main.yaml b/roles/389ds-config-logging/vars/main.yaml
deleted file mode 100644 (file)
index acdd7d7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
----
-base_logdir: '/var/log/dirsrv'
-
-logging:
-  access:
-    logfile: access.log
-    enabled: true
-  audit:
-    logfile: audit.log
-    enabled: false
-  auditfail:
-    logfile: audit.log
-    enabled: true
-  error:
-    logfile: error.log
-    enabled: true
-  security:
-    logfile: security.log
-    enabled: true
-
-# vim: filetype=yaml
diff --git a/roles/389ds-config-plugins/defaults/main.yaml b/roles/389ds-config-plugins/defaults/main.yaml
new file mode 100644 (file)
index 0000000..32d5881
--- /dev/null
@@ -0,0 +1,71 @@
+---
+
+###############################
+# Plugin memberOf
+
+ds389_plugin_memberof_config: true
+ds389_plugin_memberof_enabled: true
+ds389_plugin_memberof_attr: 'memberOf'
+ds389_plugin_memberof_groupattrs:
+  - 'member'
+  - 'uniqueMember'
+ds389_plugin_memberof_allbackends: true
+ds389_plugin_memberof_skipnested: false
+
+# Later do eval, how to maintain
+ds389_plugin_memberof_scopes: []
+ds389_plugin_memberof_escapes: []
+ds389_plugin_memberof_auto_add_oc: ~
+
+###############################
+# Plugin referential-integrity
+
+ds389_plugin_referint_config: true
+ds389_plugin_referint_enabled: true
+ds389_plugin_referint_membership_attributes:
+  - 'member'
+  - 'uniqueMember'
+  - 'owner'
+  - 'seeAlso'
+ds389_plugin_referint_logfile: 'referint.log'
+ds389_plugin_referint_update_delay: 0
+
+###############################
+# Plugin attribute uniqueness
+
+ds389_plugin_attr_uniq_config: true
+ds389_plugin_attr_uniq_purge: true
+ds389_plugin_attr_uniq_attributes: {}
+ds389_plugin_attr_uniq_attributes_default:
+  'uid':
+    ensure: present
+    enabled: true
+    subtrees: []
+    across_all_subtrees: true
+    top_entry_oc: ~
+    subtree_entries_oc: ~
+  'gidNumber':
+    ensure: present
+    enabled: true
+    subtrees: []
+    across_all_subtrees: true
+    top_entry_oc: ~
+    subtree_entries_oc: 'posixGroup'
+  'mail':
+    ensure: present
+    enabled: true
+    subtrees: []
+    across_all_subtrees: true
+    top_entry_oc: ~
+    subtree_entries_oc: 'inetLocalMailRecipient'
+  'uidNumber':
+    ensure: present
+    enabled: true
+    subtrees: []
+    across_all_subtrees: true
+    top_entry_oc: ~
+    subtree_entries_oc: ~
+
+base_logdir: '/var/log/dirsrv'
+
+# vim: filetype=yaml
diff --git a/roles/389ds-config-plugins/tasks/attr-uniq.yaml b/roles/389ds-config-plugins/tasks/attr-uniq.yaml
new file mode 100644 (file)
index 0000000..6903b8e
--- /dev/null
@@ -0,0 +1,59 @@
+---
+
+- name: "Merge attributes configuration"
+  set_fact:
+    uniq_attributes: "{{ ds389_plugin_attr_uniq_attributes_default | ansible.builtin.combine(ds389_plugin_attr_uniq_attributes, list_merge='append_rp', recursive=true) }}"
+
+- name: 'Show merged uniq_attributes'
+  debug:
+    var: uniq_attributes
+    verbosity: 2
+
+- name: 'Get the list of all attr-uniq entries.'
+  ansible.builtin.shell: "dsconf {{ slapd_instance | quote }} plugin attr-uniq list"
+  register: get_all_attr_uniq_entries
+  changed_when: false
+  check_mode: false
+
+- name: 'Show get_all_attr_uniq_entries.'
+  debug:
+    var: get_all_attr_uniq_entries
+    verbosity: 3
+
+- name: "Set cur_attr_uniq_entries."
+  set_fact:
+    cur_attr_uniq_entries: "{{ get_all_attr_uniq_entries.stdout_lines | map('regex_replace', '\\s*$', '') }}"
+
+- name: 'Show cur_attr_uniq_entries.'
+  debug:
+    var: cur_attr_uniq_entries
+    verbosity: 2
+
+- name: 'Set exp_attr_uniq_entries_lc.'
+  set_fact:
+    exp_attr_uniq_entries_lc: []
+
+- name: 'Fill exp_attr_uniq_entries_lc.'
+  set_fact:
+    exp_attr_uniq_entries_lc: "{{ exp_attr_uniq_entries_lc + [ (item.key | lower) + ' attribute uniqueness' ] }}"
+  loop: "{{ uniq_attributes | dict2items | list }}"
+
+- name: 'Show exp_attr_uniq_entries_lc.'
+  debug:
+    var: exp_attr_uniq_entries_lc
+    verbosity: 2
+
+- name: 'Purge attr-uniq entries.'
+  when: (ds389_plugin_attr_uniq_purge | bool) == true
+  block:
+
+    - name: 'Purge unnecessary attr-uniq entries.'
+      debug:
+        msg: "Deleting attr-uniq entry '{{ attr_uniq_entry }}'."
+      when: ( attr_uniq_entry | lower ) not in exp_attr_uniq_entries_lc
+      loop: "{{ cur_attr_uniq_entries }}"
+      loop_control:
+        loop_var: attr_uniq_entry
+
+
+# vim: filetype=yaml
index 19d9fc5d4afa9664a299d01be6e1a5e5dd6f027d..cc9b46808acc2eed94ab9776e5756ee7c15e1eda 100644 (file)
@@ -8,4 +8,8 @@
   include_tasks: 'referint.yaml'
   when: (ds389_plugin_referint_config | bool) == true
 
+- name: "Configuring the 389ds attr-uniq-Plugin."
+  include_tasks: 'attr-uniq.yaml'
+  when: (ds389_plugin_attr_uniq_config | bool) == true
+
 # vim: filetype=yaml
index f91dafa3754b49dff27d5b5856134592cb06156d..192dbee12b4edd9a9e60e05d5f19747037299f34 100644 (file)
@@ -21,7 +21,7 @@
 - name: "Show config hash:"
   debug:
     var: plugin_referint_config
-    verbosity: 0
+    verbosity: 2
 
 - name: 'Predefine variable exec_set to false'
   set_fact:
@@ -84,7 +84,7 @@
     - name: "Show the command to execute:"
       debug:
         var: plugin_referint_cmd
-        verbosity: 0
+        verbosity: 1
 
     - name: "Finally configure the referential-integrity plugin."
       ansible.builtin.shell: "{{ plugin_referint_cmd }}"
diff --git a/roles/389ds-config-plugins/vars/main.yaml b/roles/389ds-config-plugins/vars/main.yaml
deleted file mode 100644 (file)
index 780110c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
----
-
-###############################
-# Plugin memberOf
-
-ds389_plugin_memberof_config: true
-ds389_plugin_memberof_enabled: true
-ds389_plugin_memberof_attr: 'memberOf'
-ds389_plugin_memberof_groupattrs:
-  - 'member'
-  - 'uniqueMember'
-ds389_plugin_memberof_allbackends: true
-ds389_plugin_memberof_skipnested: false
-
-# Later do eval, how to maintain
-ds389_plugin_memberof_scopes: []
-ds389_plugin_memberof_escapes: []
-ds389_plugin_memberof_auto_add_oc: ~
-
-###############################
-# Plugin referential-integrity
-
-ds389_plugin_referint_config: true
-ds389_plugin_referint_enabled: true
-ds389_plugin_referint_membership_attributes:
-  - 'member'
-  - 'uniqueMember'
-  - 'owner'
-  - 'seeAlso'
-ds389_plugin_referint_logfile: 'referint.log'
-ds389_plugin_referint_update_delay: 0
-
-base_logdir: '/var/log/dirsrv'
-
-# vim: filetype=yaml
diff --git a/roles/389ds-restart/defaults/main.yaml b/roles/389ds-restart/defaults/main.yaml
new file mode 100644 (file)
index 0000000..201408b
--- /dev/null
@@ -0,0 +1,5 @@
+---
+
+restart_389ds: false
+
+# vim: filetype=yaml
diff --git a/roles/389ds-restart/vars/main.yaml b/roles/389ds-restart/vars/main.yaml
deleted file mode 100644 (file)
index 201408b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
----
-
-restart_389ds: false
-
-# vim: filetype=yaml
diff --git a/roles/haproxy-disable-backend/defaults/main.yaml b/roles/haproxy-disable-backend/defaults/main.yaml
new file mode 100644 (file)
index 0000000..cc0f36c
--- /dev/null
@@ -0,0 +1,11 @@
+---
+
+haproxy_user_socket: '/run/haproxy/user.sock'
+haproxy_admin_socket: '/run/haproxy/admin.sock'
+haproxy_test_socket: '/etc/passwd'
+
+haproxy_wait_for_disable: true
+haproxy_wait_interval: 2
+haproxy_wait_retries: 60
+
+# vim: filetype=yaml
diff --git a/roles/haproxy-disable-backend/vars/main.yaml b/roles/haproxy-disable-backend/vars/main.yaml
deleted file mode 100644 (file)
index cc0f36c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
----
-
-haproxy_user_socket: '/run/haproxy/user.sock'
-haproxy_admin_socket: '/run/haproxy/admin.sock'
-haproxy_test_socket: '/etc/passwd'
-
-haproxy_wait_for_disable: true
-haproxy_wait_interval: 2
-haproxy_wait_retries: 60
-
-# vim: filetype=yaml