I have a problem when I execute commands with some special characters like |
on remote nodes. For instance, if I run ls /var/log/ | grep rundeck
locally, the result is correct as shown in command_locally, whereas in a node the error that appears in command_remotely occurs (this node also has Rundeck installed and the folder 'rundeck' exists, so the command should work).
I face the same issue when I create a global log filter such as Key Value Data. I want to get the shell that is being used, so I create a job with a Key Value Data, then I add a first step which consists in running the command env
, and a second one, echo 'SHELL is "${data.SHELL}"'
, to show the variable that I obtained from the log (example extracted from here). It works perfectly in localhost but it does not capture any data when a remote node is selected. This can be seen in Key_Value_Data_locally and Key_Value_Data_remotely respectively.
I would like to know if this is a bug or it is me that I am doing something wrong when it comes to executing something remotely. I use the Ansible plugin for Rundeck, could it be something related to that?
EDIT 1 WITH JOB DEFINITIONS:
Job with command. Locally works, remotely fails.
- defaultTab: output
description: ''
executionEnabled: true
id: 4e10310c-b5e2-419e-a828-1ed7df4840e9
loglevel: INFO
name: Command_problem
nodeFilterEditable: false
scheduleEnabled: true
sequence:
commands:
- exec: ls /etc | grep yum
keepgoing: false
strategy: node-first
uuid: 4e10310c-b5e2-419e-a828-1ed7df4840e9
Job with Key Value Data. Locally works, remotely does not capture any data.
- defaultTab: output
description: ''
executionEnabled: true
id: 1da43d9b-691d-437b-882e-8fbee2790c73
loglevel: INFO
name: Key_Value_Data_problem
nodeFilterEditable: false
scheduleEnabled: true
sequence:
commands:
- exec: env
- exec: ' echo ''SHELL is "${data.SHELL}"'''
keepgoing: false
pluginConfig:
LogFilter:
- config:
logData: 'false'
regex: ^(SHELL|USER|PWD)\s*=\s*(.+)$
type: key-value-data
strategy: node-first
uuid: 1da43d9b-691d-437b-882e-8fbee2790c73
EDIT 2 WITH JOB OUTPUT ON DEBUG MODE:
I have changed the ip of the Rundeck machine and the node for 'localhost' and 'node ip' respectively, and the real username for 'user name'.
Command problem: output on debug mode
Key Value Data problem: output on debug mode
EDIT 3:
I have figured out what the problem was. It is the line force_color = 1
that I added to the ansible.cfg file to get colorful output in Rundeck. If I remove that part, the Key Value Data feature works perfectly on remotes nodes as well. I guess it is a bug.