User Tools

Site Tools


menu:operate:new_jobs:cmdb_jobs
LDAP: couldn't connect to LDAP server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
menu:operate:new_jobs:cmdb_jobs [2021/10/21 13:18] pgelsmenu:operate:new_jobs:cmdb_jobs [2022/05/02 07:34] (current) yspeerte
Line 1: Line 1:
 +{{indexmenu_n>1}}
 +
 +====== CMDB jobs ======
 +
 +Basic command jobs issues CLI commands to any (supported) device. It allows the use of simple CLI commands and templates, variable substitution from the [[menu:inventory:cmdb:cmdb|CMDB]] node, the 'CMDB' [[menu:build:regions|Region]], or the [[menu:build:domains|Domain]] and scenarios.
 +
 +It requires some attributes to be set:
 +
 +  * Management IP (cmdb node)
 +  * CMDB node linked to a Domain
 +  * Username (domain > User > Rme_user)
 +  * Password (domain > User > Rme_passwd)
 +
 +
 +===== Selecting the nodes =====
 +
 +The nodes can be added directly using the text field. Multiple hostnames, ip addresses or FQDNs can added be at once. Just make sure they are separated by a comma, whitespace, semicolon or newline. If these nodes already exist in the database, that specific node is used. If the node doesn't exist yet, you are still allowed to execute jobs on that node, but you will have to enter the required Domain and vendor each time.
 +
 +Alternatively, nodes can be selected from the ''Node groups'' as well. The ''Group tag'' filter can be used to filter the type of node groups shown. 
 +
 +{{:menu:operate:new_jobs:basic_cmd_job_select.png?nolink&800|}}
 +
 +
 +===== Selected nodes =====
 +
 +Once the [Next] button is clicked, the selected nodes are listed at the top of the page. If a nodes' information is incomplete, dropdown menus are enabled to complete the information. The checkbox left to each node name marks it for scheduling a job for this node. Nodes are automatically de-selected if information was lacking.
 +
 +The ''Address'' field will accept IPv4 or IPv6 addresses or the full-qualified-domain-name (fqdn) for the node. This will be used to establish a management session with the node. In case a fqdn is used, ensure the DNS can resolve it.
 +
 +When the nodes' source is labeled as a 'CMDB' node and the user had to provide additional information before it could be scheduled, this information will be saved. This will only happen is the node is actually scheduled.
 +
 +{{:menu:operate:new_jobs:basic_cmd_job_nodes.png?nolink&800|}}
 +
 +
 +===== Jobs, Commands, Scenario =====
 +
 +The Commands and Scenario text fields can be modified for single use or can be stored to re-use.
 +
 +{{:menu:operate:new_jobs:basic_cmd_job_example.png?nolink&800|Basix command job example}}
 +
 +
 +==== Load job ====
 +
 +Modifications made to ''Commands'' and ''Scenario'' can be stored. This can be use full for recurring changes, like password updates.
 +
 +To save a job, make sure to provide a unique name and press save. This will make sure the client-type, description, Commands and Scenario values are saved. 
 +
 +Next time this job is available from the drop-down menu. By marking the stored-job ''public'', other users will have access to this job definition too.
 +
 +==== Commands ====
 +The Commands field can be used to provide the configuration lines to be sent to the node. These line can be a combination of:
 +
 +  * plain configuration lines
 +  * configuration lines using variables ( ''<variable>'' )
 +  * template name ( ''{template}'' )
 +
 +Variables are available as attributes within the node (either ad-hoc, CMDB or YCE). Ad-hoc nodes (unknown to CMDB or YCE) don't have any variables but will defer to shared CMDB variables. Since all nodes refer to a [[menu:build:domains|Domain]] for the login credentials, all variables of the referred Domain are available to the job. Likewise, the Region 'CMDB' offers its set of (customizable) variables.
 +
 +Besides the database variables, runtime variables are available as well and can be added to the ''[[menu:operate:new_jobs:cmdb_jobs#Scenario|[[parameters]]]]'' section of the ''Scenario''.
 +
 +Templates can be included using ''{template}}'' syntax. This allows to have vendor agnostic jobs, since templates with the same name can exist for every vendor (and subtype). See [[menu:build:templates:template_edit|templates]] for more information. 
 +
 +A **plain configuration** line could be: \\
 +''snmp-server host 1.2.3.4''
 +
 +The same could be achieve using a **domain variable**: \\
 +''snmp-server host <Snmp_traphost1>''
 +
 +Calling the **snmp template** would look like: \\
 +''{snmp}''
 +
 +=== Evaluate ===
 +The ''[Evaluate]'' button allows you to test the configuration and the variable substitution for a specific node.
 +
 +The first node with its checkbox set will be used for the 'evaluate' function.
 +
 +
 +==== Scenario ====
 +With the scenario you are in control of the order of communication and execution of commands and functions.
 +
 +The scenario allow you to specify runtime variables in the ''<nowiki>[[parameters]]</nowiki>'' section and allows tasks and functions to be entered within the ''<nowiki>[[scenario]]</nowiki>'' section.
 +
 +Below an example is shown on the parameter variables for runtime use.
 +
 +{{menu:operate:new_jobs:operate_basic_cmd_d.png?nolink&400|Scenario}}
 +
 +The ''task = Basic_cmd_job'' is a shortcut to include the stored scenario of that name at this point in the scenario. 
 +The (default) contents of this scenario/task simply imports the commands one by one on the node CLI and aborts on the first command failure.
 +
 +On error, the action is logged a failure and the scenario ''**stop**''s and is listed as <color red>FAILED</color>, otherwise the log lists completed and the job ''**end**''s as <color green>SUCCESSFUL</color>.  
 +
 +<code>
 +Description <node> Basic command job
 +
 +Cmd_exec_basic -n <node> -a <node_addr> -v <vendor_type> -d <domain> -f <node>.cmd <verbose>
 +if <error>
 +    Log_action -n <node> -a Basic_cmd_job -m "Failed executing commands"
 +    stop
 +endif
 +Log_action -n <node> -a Basic_cmd_job -m "Completed executing commands"
 +</code>
 +
 +
 +
 +Here you can dive deeper into [[menu:operate:scenarios:scenarios|scenarios and its functions]].
 +
 +===== Scheduler =====
 +
 +Once you are happy with the configuration you wish to push, the job can be scheduled using the scheduler. Select an execution moment in the future or select ''Now'' and press schedule.
 +
 +{{:menu:operate:new_jobs:cmd_job_schedule.png?nolink&800|}}
 +
 +If you wish to read more on the scheduler, more information can be found here: [[guides:reference:jobs:distr_scheduler|Scheduler]]