In OBM, is it possible to add a node to multiple groups using opr-node command
Yeah, that is how we handle it. We automate it via a script. In our case we are on Windows. I first create an input file with the each line containing the node and a separator (pipe | in our case) then the list of its node groups that node should belong to separated by a different separator (colon in our case) , then the script loops each line of the file and parses/splits with pipe separator to get the node FQDN into variable and the list of node groups for that node into a string. For each node it loops through the node groups list and assigns the node to the node groups via opr-node command. See my example below.
Example of one input file line:
Example Batch script:
cd "<drive>:\<path_to_dir_where inputfile_and_script_reside>"
for /f "tokens=1,2* delims=| " %%a in (<inputfilenamehere>) do (
echo FQDN is !FQDN!
echo !FQDN! NG List is !NGLIST!
REM the line below replaces the colon delimiter with a comma which is the default delimiter so the following for loop will iterate the unknown number of items in the list using a comma as a delimiter by default
for %%g in (!NGLIST!) do (
echo adding node !FQDN! to Node Group !NG!
cmd /c opr-node -modify_node -node_name "!FQDN!" -node_group !NG! -parent_node_group <parent_nodegroup_name_here> -username <username> -password <pwd>-ssl
exit /b 0