I want to deploy a script from a Linux machine.

This is the script I want to run on servers using racadm but I am getting errors in that code.

#!/bin/bashIDRAC_IP_LIST="idrac_ips.txt"USERNAME="root"# Securely read passwords from hidden filesLOCAL_IDRAC_PASSWORD=$(< /root/.idrac_local_pass)LDAP_BIND_PASSWORD=$(< /root/.idrac_ldap_pass)# Trim whitespace (especially newlines)LOCAL_IDRAC_PASSWORD=$(echo -n "$LOCAL_IDRAC_PASSWORD")LDAP_BIND_PASSWORD=$(echo -n "$LDAP_BIND_PASSWORD")echo "Starting LDAP configuration rollout to iDRACs..."while IFS= read -r IP || [[ -n "$IP" ]]; doecho "----------------------------------------"echo "Configuring iDRAC at $IP ..."OUTPUT=$(racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.Enable 1 &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.ServerAddress ldap2.myuni.ac.uk &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.ServerPort 636 &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.UseSSL 1 &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.BindDN "cn=ldapusername,ou=auth-users,ou=LDAP,ou=UNI,o=MYUNI" &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.BindPass "$LDAP_BIND_PASSWORD" &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.BaseDN "ou=ITADMINS,ou=ORGADMINS,o=MYUNI" &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.UserAttribute cn &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.GroupAttribute member &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.SearchFilter "(&(objectClass=inetOrgPerson)(member=cn=%USERNAME%,ou=ITROLES,ou=ORGADMINS,o=MYUNI))" &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.GroupDN "cn=role-it-csi-team,ou=ITROLES,ou=ORGADMINS,o=MYUNI" &&racadm -r "$IP" -u "$USERNAME" -p "$LOCAL_IDRAC_PASSWORD" set iDRAC.LDAP.UserAuthorizationEnable 1 &&racadm -r "$IP" -u "$USERNAME" -p "$IDRAC_PASSWORD" set iDRAC.LDAP.CertValidation 0) 2>&1if [[ $? -eq 0 ]]; thenecho "Success: LDAP settings updated on $IP"elseecho "ERROR on $IP:"echo "$OUTPUT"fidone < "$IDRAC_IP_LIST"echo "----------------------------------------"echo "All done."But this is the error that is displayed:root@fred-linux:~# ./idrac_ldap_config.shStarting LDAP configuration rollout to iDRACs...----------------------------------------Configuring iDRAC at 10.5.0.9 ...ERROR on 10.5.0.9:Security Alert: Certificate is invalid - self-signed certificateContinuing execution. Use -S option for racadm to stop execution on certificate-related errors.[Key=iDRAC.Embedded.1#LDAP.1]Object value modified successfullySecurity Alert: Certificate is invalid - self-signed certificateContinuing execution. Use -S option for racadm to stop execution on certificate-related errors.ERROR: Invalid object specified.----------------------------------------Configuring iDRAC at 10.5.0.11 ...ERROR on 10.5.0.11:Security Alert: Certificate is invalid - self-signed certificateContinuing execution. Use -S option for racadm to stop execution on certificate-related errors.[Key=iDRAC.Embedded.1#LDAP.1]Object value modified successfullySecurity Alert: Certificate is invalid - self-signed certificateContinuing execution. Use -S option for racadm to stop execution on certificate-related errors.ERROR: Invalid object specified.----------------------------------------All done.

Can you let me know what is wrong with this script or whether there should be some amendments?

2 Spice ups

Poorly

ERROR on 10.5.0.9: Security Alert: Certificate is invalid - self-signed certificate Continuing execution. Use -S option for racadm to stop execution on certificate-related errors.
ERROR: Invalid object specified.

Could be try to fix the certificate it’s complaining about, and/or verify the object specified is valid.

Hopefully this points you in a good direction.

Actually we don’t use certificates for iDrac.

Well the error tells you to use -S to stop the error message. however, reading the actual error Invalid object specified.