Big news! The community will be moving to a new platform April 21. Read more.
Big news! The community will be moving to a new platform April 21. Read more.
Vice Admiral Vice Admiral
Vice Admiral
247 views

add node to multiple groups in OBM

Jump to solution

Hi,

In OBM, is it possible to add a node to multiple groups using opr-node command

Regards,
Sridhara.
0 Likes
1 Solution

Accepted Solutions
Fleet Admiral Fleet Admiral
Fleet Admiral

yes. you just need to execute it several times, for each group one run. 🙂

you can use a loop for this. Bash is your friend

View solution in original post

2 Replies
Fleet Admiral Fleet Admiral
Fleet Admiral

yes. you just need to execute it several times, for each group one run. 🙂

you can use a loop for this. Bash is your friend

View solution in original post

Admiral Admiral
Admiral

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:

<actualFQDNofNodeHere>|NodeGrp1:NodeGrp2:NodeGrp3

Example Batch script:

@echo off

SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

cd "<drive>:\<path_to_dir_where inputfile_and_script_reside>"

for /f "tokens=1,2* delims=| " %%a in (<inputfilenamehere>) do (
set FQDN=%%a
echo.
echo FQDN is !FQDN!
set NGLIST=%%b
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
set NGLIST=!NGLIST::=,!
for %%g in (!NGLIST!) do (
set NG=%%g
echo.
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

 

"Read-Aim-Fire, NOT Ready-Fire-Aim"
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.