--- /dev/null
+---
+
+- name: "Checking and modifying attr-uniq entry."
+ debug:
+ var: entry_name
+ verbosity: 0
+
+- name: 'Get the current configuration of the attr-uniq entry.'
+ ansible.builtin.shell: "dsconf {{ slapd_instance | quote }} plugin attr-uniq show {{ entry_name | quote }} | \
+ grep -P -i '^(uniqueness-|nsslapd-pluginEnabled)' | \
+ sed -e 's/^uniqueness-//i' -e 's/nsslapd-pluginE/e/i' | \
+ sort -i || true"
+ register: get_plugin_attr_uniq
+ changed_when: false
+ check_mode: false
+
+- name: 'Show raw attr-uniq entry config.'
+ debug:
+ var: get_plugin_attr_uniq
+ verbosity: 3
+
+- name: "Set variable attr_uniq_config"
+ set_fact:
+ attr_uniq_config: "{{ get_plugin_attr_uniq.stdout_lines | cfg_389ds_to_dict }}"
+
+- name: "Show config hash:"
+ debug:
+ var: attr_uniq_config
+ verbosity: 0
+
+- name: 'Predefine variable exec_set to false'
+ set_fact:
+ exec_set: false
+
+- name: 'Predefine variable remove_attr_uniq_entry_before'
+ set_fact:
+ remove_attr_uniq_entry_before: false
+
+- name: "Set exp_entry_enabled to default true."
+ set_fact:
+ exp_entry_enabled: true
+
+- name: "Set exp_entry_enabled by config."
+ set_fact:
+ exp_entry_enabled: "{{ entry_data['enabled'] | bool }}"
+ when: "'enabled' in entry_data"
+
+- name: "Check attr-uniq entry for enabled."
+ set_fact:
+ exec_set: true
+ when: "attr_uniq_config['enabled'] != exp_entry_enabled"
+
+- name: "Set remove_attr_uniq_entry_before to true in case of no subtrees expected."
+ set_fact:
+ remove_attr_uniq_entry_before: true
+ exec_set: true
+ when: "'subtrees' in attr_uniq_config and ('subtrees' not in entry_data or entry_data['subtrees'] | length == 0)"
+
+- name: "Set cur_subtrees to an empty list, if none were found"
+ set_fact:
+ cur_subtrees: "{{ [] }}"
+ when: "'subtrees' not in attr_uniq_config"
+
+- name: "Set cur_subtrees, if some were found."
+ set_fact:
+ cur_subtrees: "{{ attr_uniq_config['subtrees'] }}"
+ when: "'subtrees' in attr_uniq_config"
+
+- name: "Check subtrees"
+ set_fact:
+ exec_set: true
+ when: "('subtrees' in entry_data and entry_data['subtrees'] | length > 0 ) and (cur_subtrees | compare_lc_list(entry_data['subtrees']) == false)"
+
+- name: "Check attribute name"
+ set_fact:
+ exec_set: true
+ when: "(attr_uniq_config['attribute-name'] | lower) != ( attr_name | lower )"
+
+- name: "Check across-all-subtrees for should be vanished."
+ set_fact:
+ remove_attr_uniq_entry_before: true
+ exec_set: true
+ when: "('across-all-subtrees' in attr_uniq_config) and ('across_all_subtrees' not in entry_data or entry_data['across_all_subtrees'] == None)"
+
+- name: "Check across-all-subtrees"
+ set_fact:
+ exec_set: true
+ when: "'across_all_subtrees' in entry_data and entry_data['across_all_subtrees'] != None and ('across-all-subtrees' not in attr_uniq_config or entry_data['across_all_subtrees'] != attr_uniq_config['across-all-subtrees'])"
+
+# vim: filetype=yaml