Skip to content

Commit

Permalink
Use node attribute as conf src for node-executor
Browse files Browse the repository at this point in the history
  • Loading branch information
blu-base committed Nov 13, 2023
1 parent 6afc5d4 commit 4338de5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ Plugin Configuration:
* `Additional Arguments` can be used to set further keyword arguments for
salt's `cmd.run` module. Optional. See its documentation for further details:
[here](https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.cmdmod.html#salt.modules.cmdmod.run)
* The node attribute `salt-cmd-run-args` can also be used to provide additional
arguments to salt's `cmd.run` module, individually per node.

E.g.:
```yaml
minion.example.org:
hostname: minion.example.org
nodename: foobar_minion
username:
node-executor: salt-node-executor
salt-cmd-run-args: "env='{\"FOO\": \"bar\"}'"
```



## Build
Expand Down
4 changes: 4 additions & 0 deletions contents/salt_node_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
DataItem('host', 'RD_NODE_HOSTNAME', 'str'),
DataItem('runas', 'RD_CONFIG_RUNAS', 'str'),
DataItem('args', 'RD_CONFIG_CMD_RUN_ARGS', 'shstr'),
DataItem('node-args', 'RD_NODE_SALT_CMD_RUN_ARGS', 'shstr'),
DataItem('url', 'RD_CONFIG_URL', 'str'),
DataItem('eauth', 'RD_CONFIG_EAUTH', 'str'),
DataItem('user', 'RD_CONFIG_USER', 'str'),
Expand All @@ -37,6 +38,9 @@ def main():
if data['args'] is not None and data['args'] != '':
args.extend(data['args'])

if data['node-args'] is not None and data['node-args'] != '':
args.extend(data['node-args'])

# payload
low_state = {
'client': 'local',
Expand Down

0 comments on commit 4338de5

Please sign in to comment.