configure_ldap.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Enable LDAP
  16. community.general.idrac_redfish_config:
  17. category: Manager
  18. command: SetManagerAttributes
  19. resource_id: iDRAC.Embedded.1
  20. manager_attributes:
  21. LDAP.1.Enable: "Enabled"
  22. LDAP.1.Server: "{{ ldap_server_address }}"
  23. LDAP.1.BaseDN: "{{ base_dn }}"
  24. LDAP.1.UserAttribute: "{{ user_attribute }}"
  25. LDAP.1.GroupAttribute: "{{ group_attribute }}"
  26. LDAP.1.GroupAttributeIsDN: "{{ group_attribute_is_dn }}"
  27. LDAP.1.BindDN: "{{ bind_dn }}"
  28. LDAP.1.BindPassword: "{{ bind_password }}"
  29. LDAP.1.SearchFilter: "{{ search_filter }}"
  30. LDAP.1.CertValidationEnable: "{{ cert_validation_enable }}"
  31. LDAPRoleGroup.1.DN: "{{ role_group1_dn }}"
  32. baseuri: "{{ inventory_hostname }}"
  33. username: "{{ idrac_username }}"
  34. password: "{{ idrac_password }}"
  35. register: enable_ldap
  36. no_log: true
  37. when: ldap_directory_services == "enabled"
  38. - name: Update LDAP port and role group 1 privilage
  39. command: sshpass -p {{ idrac_password }} ssh -o "StrictHostKeyChecking no" {{ idrac_username }}@{{ inventory_hostname }} 'racadm set {{ item.name }} {{ item.value }}'
  40. changed_when: true
  41. no_log: true
  42. when: ldap_directory_services == "enabled"
  43. with_items:
  44. - { name: "iDRAC.LDAP.Port", value: "{{ ldap_port }}" }
  45. - { name: "iDRAC.LDAPRoleGroup.1.Privilege", value: "{{ role_group1_privilege_id }}" }
  46. - name: Disable LDAP
  47. community.general.idrac_redfish_config:
  48. category: Manager
  49. command: SetManagerAttributes
  50. resource_id: iDRAC.Embedded.1
  51. manager_attributes:
  52. LDAP.1.Enable: "Disabled"
  53. baseuri: "{{ inventory_hostname }}"
  54. username: "{{ idrac_username }}"
  55. password: "{{ idrac_password }}"
  56. register: disable_ldap
  57. when: ldap_directory_services == "disabled"