-
Notifications
You must be signed in to change notification settings - Fork 0
StepsShellCommand
Shell Command Structure Section
Shell command allows to execute remote shell commands, based on specific request on target OS default user shell.
Here command syntax sample:
- name: My Shell Comand, iterating for a list of input name items
shell:
exec: echo "{{ MyVarName1 }}-{{ MyVarName2 }}-{{ item }}" > ~/my-access-file.log
runAs: gouser #not implemented yet
asRoot: false #not implemented yet
withVars:
- MyVarName1
- MyVarName2
withList:
- Michael White
- Joseph Green
- John Red
Here we have a spool shell command on a file with the content of the 2 valiables, iterated for the {{ item }} from the provided list, all contatenated ad replaced before the command is executed. Totally we will have 3 noew rows in the file.
Another useful case is :
- name: My Shell Comand, using fixed custom variables and saving the state in myNewSessionVariable
shell:
exec: cat ~/{{ MyVarName1 }}-{{ MyVarName2 }}-all.log
runAs: gouser #not implemented yet
asRoot: false #not implemented yet
withVars:
- MyVarName1
- MyVarName2
saveState: myNewSessionVariable
In this case differently the output is used to collect data in a variable, raw dara, used in future for other operations. The save state clause can be used even in case of multiple list items, with meaningful increase of memory usage and payload in server/client communication (2-3kb to 5-50kb for 1000 lines of 0.5kb each). No memory limit or tranfer traffic is affected by the command in a DMZ or dedicated / same network or subnet or datacenter or single zone. In any other case we kindly require to examinate traffic limitations between nodes in nearby networks.
We will allow, in a near future, the creation of a grouped by report and host using all session states, required by the user, via template file.
Use cases for this command are related to the interaction with the the target operating system, and in the details with the default shell.
We will provide soon a switcher to chose one session on the top of others, accordingly to the final O/S.
Come back to the Steps Structure Section