From: Frank Brehm Date: Thu, 2 Jan 2025 16:56:17 +0000 (+0100) Subject: Using evaluated configuration in roles/389ds-config-plugins/tasks/memberof.yaml X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=41caa8ff52868a61e7cd0b90620f2efd2365789b;p=pixelpark%2Fpp-admin-tools.git Using evaluated configuration in roles/389ds-config-plugins/tasks/memberof.yaml --- diff --git a/roles/389ds-config-plugins/tasks/main.yaml b/roles/389ds-config-plugins/tasks/main.yaml index 8bb3fd3..d7967db 100644 --- a/roles/389ds-config-plugins/tasks/main.yaml +++ b/roles/389ds-config-plugins/tasks/main.yaml @@ -23,9 +23,9 @@ ds389_plugin_memberof_config: true when: ds389_plugin_memberof_config is undefined -# - name: "Configuring the 389ds memberOf-Plugin." -# include_tasks: 'memberof.yaml' -# when: (ds389_plugin_memberof_config | bool) == true +- name: "Configuring the 389ds memberOf-Plugin." + include_tasks: 'memberof.yaml' + when: (ds389_plugin_memberof_config | bool) == true - name: "Set default for ds389_plugin_referint_config." set_fact: diff --git a/roles/389ds-config-plugins/tasks/memberof.yaml b/roles/389ds-config-plugins/tasks/memberof.yaml index b609eb2..30e0676 100644 --- a/roles/389ds-config-plugins/tasks/memberof.yaml +++ b/roles/389ds-config-plugins/tasks/memberof.yaml @@ -1,28 +1,10 @@ --- -- name: 'Get the current configuration of the memberOf-Plugin.' - ansible.builtin.shell: "dsconf {{ slapd_instance | quote }} plugin memberof show | \ - grep -P -i '^(memberof|nsslapd-pluginEnabled)' | \ - sed -e 's/^memberof//i' -e 's/nsslapd-plugin//i' | tr '[:upper:]' '[:lower:]' | \ - sort || true" - register: plugin_memberof - changed_when: false - check_mode: false - - name: 'Show raw memberof attribute config.' debug: var: plugin_memberof verbosity: 3 -- name: "Set variable plugin_memberof_config" - set_fact: - plugin_memberof_config: "{{ plugin_memberof.stdout_lines | cfg_389ds_to_dict }}" - -- name: "Show config hash:" - debug: - var: plugin_memberof_config - verbosity: 0 - - name: 'Predefine variable exec_set to false' set_fact: exec_set: false @@ -30,27 +12,27 @@ - name: 'Check for attr.' set_fact: exec_set: true - when: '"attr" not in plugin_memberof_config or plugin_memberof_config["attr"] != ( ds389_plugin_memberof_attr | lower )' + when: '"attr" not in ds389_plugin_config.memberof or ( ds389_plugin_config.memberof["attr"] | lower ) != ( ds389_plugin_memberof_attr | lower )' - name: 'Check for groupattrs not set.' set_fact: exec_set: true - when: '"groupattr" not in plugin_memberof_config' + when: '"groupattr" not in ds389_plugin_config.memberof' - name: 'Check for groupattrs.' set_fact: exec_set: true - when: '"groupattr" in plugin_memberof_config and (plugin_memberof_config["groupattr"] | compare_lc_list(ds389_plugin_memberof_groupattrs) != true)' + when: '"groupattr" in ds389_plugin_config.memberof and (ds389_plugin_config.memberof["groupattr"] | compare_lc_list(ds389_plugin_memberof_groupattrs) != true)' - name: 'Check for allbackends.' set_fact: exec_set: true - when: '"allbackends" not in plugin_memberof_config or plugin_memberof_config["allbackends"] != ds389_plugin_memberof_allbackends' + when: '"allbackends" not in ds389_plugin_config.memberof or ds389_plugin_config.memberof["allbackends"] != ds389_plugin_memberof_allbackends' - name: 'Check for skipnested.' set_fact: exec_set: true - when: '"skipnested" not in plugin_memberof_config or plugin_memberof_config["skipnested"] != ds389_plugin_memberof_skipnested' + when: '"skipnested" not in ds389_plugin_config.memberof or ds389_plugin_config.memberof["skipnested"] != ds389_plugin_memberof_skipnested' - name: "Has the memberOf-Plugin to be configured:" debug: @@ -117,7 +99,7 @@ ansible.builtin.shell: "{{ plugin_memberof_cmd }}" - name: "Enabling memberof plugin." - when: "plugin_memberof_config['enabled'] == false and ds389_plugin_memberof_enabled == true" + when: "ds389_plugin_config.memberof['enabled'] == false and ds389_plugin_memberof_enabled == true" block: - name: "Enabling memberof plugin." @@ -128,7 +110,7 @@ restart_389ds: true - name: "Disabling memberof plugin." - when: "plugin_memberof_config['enabled'] == true and ds389_plugin_memberof_enabled == false" + when: "ds389_plugin_config.memberof['enabled'] == true and ds389_plugin_memberof_enabled == false" block: - name: "Disabling memberof plugin."