opConfig Credential Sets CLI

From opConfig 4.3.2, a new CLI with CRUD operations for credential sets is available.

Please note, that credential sets can also be managed in the opConfig GUI or in the API

 opconfig-cli.pl act=list_credential_sets [name='set name']
 opconfig-cli.pl act=create_credential_set file='file path.json'
 opconfig-cli.pl act=update_credential_set name='set name' file='file path.json'
 opconfig-cli.pl act=delete_credential_set name='set name'
 opconfig-cli.pl act=assign_credential_set name='set name' node=nodeX

List Credential Sets

List all the credential sets in json format:

/usr/local/omk/bin/opconfig-cli.pl act=list-credential-sets
{
   "testapi" : {
      "always_privileged" : "0",
      "description" : "new descript4",
      "lastupdate" : 1645085578,
      "password" : "*****",
      "password_privileged" : "*****",
      "setname" : "testapi",
      "ssh_key" : "",
      "username" : "nmis"
   },
   "ubu" : {
      "always_privileged" : "0",
      "description" : "test",
      "lastupdate" : 1643796740,
      "password" : "*****",
      "password_privileged" : "*****",
      "setname" : "ubu",
      "ssh_key" : "",
      "username" : "test"
   }
}

List one credential set by name in json format: 

/usr/local/omk/bin/opconfig-cli.pl act=list-credential-sets name=asgard

{
   "always_privileged" : "0",
   "description" : "",
   "lastupdate" : 1631098471,
   "password" : "*****",
   "password_privileged" : "*****",
   "setname" : "asgard",
   "ssh_key" : "",
   "username" : "admin"
}

Create Credential Set

Create a new credential set with a file in json format containing the credential set information. 

/usr/local/omk/bin/opconfig-cli.pl act=create-credential-set file=/tmp/credset.json 

Example of credset.json file: 

{"always_privileged": "0",
"description": "new test descript4",
"lastupdate": 1625045906,
"setname": "mycredset",
"ssh_key": "",
"username": "nmis",
"password": "pwd"
}

At least password, privileged password or SSH Key are required. 

Update Credential Set

Update a credential set with a file in json format containing the credential set information. 

/usr/local/omk/bin/opconfig-cli.pl act=update-credential-set file=/tmp/credset.json name=mycredset 

Example of credset.json file: 

{"always_privileged": "0",
"description": "new test descript4",
"lastupdate": 1625045906,
"setname": "mycredset",
"ssh_key": "",
"username": "nmis",
"password": "pwd"
}

We can omit the password, privileged password and SSH Key, the saved ones will be used. 

Delete Credential Set

Delete a credential set using the name: 

/usr/local/omk/bin/opconfig-cli.pl act=delete-credential-set name=mycredset 


Assign Credential Set

Assign a credential set to a node:

/usr/local/omk/bin/opconfig-cli.pl act=assign-credential-set name=mycredset node=mynode