CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2024-09-09
by MegaDrive68k

Original Post

Original - Posted on 2024-05-22
by MegaDrive68k



            
Present in both answers; Present only in the new answer; Present only in the old answer;

You can use the node tags context variables, for example:
This node model source file contains the following attributes:
```xml <?xml version="1.0" encoding="UTF-8"?>
<project> <node name="node00" description="Node 00" tags="" hostname="192.168.56.20" osArch="amd64" osFamily="unix" osName="Linux" osVersion="5.14.0-284.30.1.el9_2.x86_64"/> </project> ```
Then, in the node context (explained [here](https://docs.rundeck.com/docs/manual/job-workflows.html#node-context-variables-node-scope)) you can call any node attribute as follows:
_Command steps_
```bash echo ${node.hostname} ```
_Script steps_
```bash echo @node.hostname@ ```
_Job definition example_
```yaml - defaultTab: nodes description: '' executionEnabled: true id: 832af74f-d454-4b87-863a-ce4691f082b7 loglevel: INFO name: helloworld nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: false threadcount: '1' filter: 'name: node00 ' nodesSelectedByDefault: true plugins: ExecutionLifecycle: {} scheduleEnabled: true sequence: commands: - exec: echo ${node.hostname} - fileExtension: .sh interpreterArgsQuoted: false script: echo @node.hostname@ scriptInterpreter: /bin/bash keepgoing: false strategy: node-first uuid: 832af74f-d454-4b87-863a-ce4691f082b7 ```
Two jobs: the first one dispatched to the `node00`, executes a command, and stores the result in a data value. In this job, you can call another job (via the [job reference step][1]) dispatched to `node01` with a specific option, this option "[receives][2]" the data value from the first job.
I made an example (tested on Rundeck 5.2).
JobONE:
```yaml - defaultTab: nodes description: '' executionEnabled: true id: 6eeb1cdc-b17d-4c05-9511-a80cdea2212a loglevel: INFO name: JobONE nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: false threadcount: '1' filter: node00 nodesSelectedByDefault: true plugins: ExecutionLifecycle: {} scheduleEnabled: true sequence: commands: - exec: echo "universe" plugins: LogFilter: - config: invalidKeyPattern: \s|\$|\{|\}|\\ logData: 'true' name: mydata regex: (.*) replaceFilteredResult: 'false' type: key-value-data - jobref: args: -myoption ${data.mydata} group: '' name: JobTWO nodeStep: 'true' uuid: fa0e282d-7ebe-4d88-bf10-709cfd4c0fb2 keepgoing: false strategy: node-first uuid: 6eeb1cdc-b17d-4c05-9511-a80cdea2212a ```
JobTWO:
```yaml - defaultTab: nodes description: '' executionEnabled: true id: fa0e282d-7ebe-4d88-bf10-709cfd4c0fb2 loglevel: INFO name: JobTWO nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: false threadcount: '1' filter: node01 nodesSelectedByDefault: true options: - name: myoption value: world plugins: ExecutionLifecycle: {} scheduleEnabled: true sequence: commands: - exec: echo "hello ${option.myoption}" keepgoing: false strategy: node-first uuid: fa0e282d-7ebe-4d88-bf10-709cfd4c0fb2 ```
Check the result [here][3].

[1]: https://docs.rundeck.com/docs/manual/node-steps/builtin.html#job-reference-step [2]: https://docs.rundeck.com/docs/learning/howto/passing-variables.html [3]: https://imgur.com/WqoHVDU

        
Present in both answers; Present only in the new answer; Present only in the old answer;