Problem:
REX jobs run with the ssh user and effective user set to the one I’ve created for foreman runs (as opposed to the default ssh user set to root) fail.
Example: running a command ‘echo Hello’ on a remote host gives the following output in production.log:
Parameters: {"callback"=>{"task_id"=>"61722689-ae48-43a1-b4f4-96ed92269a0f", "step_id"=>3}, "data"=>{"result"=>[{"output_type"=>"stdout", "output"=>"Hello\nIllegal variable name.\nIllegal variable name.\nelse: endif not found.\n", "timestamp"=>1716992185.0838587}], "runner_id"=>"0dbf0f60-00a6-41b8-8022-e29eaa79c00a", "exit_status"=>1}, "task"=>{}}
The correct output actually shows up at the start there. i.e. If I run ‘date’ command instead, the output does show the date at the start
"output"=>"Wed May 29 07:51:26 AM PDT 2024\nIllegal variable name.\nIllegal variable name.\nelse: endif not found.\n",
The same jobs run with ssh user root succeed. Wondering if it’s an issue with the shell of the user running the command?
Root user is using /bin/bash
My foreman user ‘foremanuser’ for ssh runs is using /bin/tcsch
Expected outcome:
The job returns success
Foreman and Proxy versions:
foreman-release-3.10.0-1.el9.noarch
foreman-proxy-3.10.0-1.el9.noarch
Foreman and Proxy plugin versions:
rubygem-hammer_cli_foreman-3.10.0-1.el9.noarch
foreman-cli-3.10.0-1.el9.noarch
rubygem-hammer_cli_foreman_puppet-0.0.7-1.el9.noarch
foreman-selinux-3.10.0-1.el9.noarch
foreman-3.10.0-1.el9.noarch
foreman-postgresql-3.10.0-1.el9.noarch
foreman-service-3.10.0-1.el9.noarch
foreman-dynflow-sidekiq-3.10.0-1.el9.noarch
foreman-redis-3.10.0-1.el9.noarch
rubygem-foreman_puppet-6.2.0-1.fm3_10.el9.noarch
foreman-installer-3.10.0-1.el9.noarch
ansible-collection-theforeman-foreman-4.0.0-2.el9.noarch
rubygem-foreman-tasks-9.1.1-1.fm3_11.el9.noarch
rubygem-foreman_remote_execution-12.0.5-3.fm3_10.el9.noarch
rubygem-foreman_ansible-13.0.3-2.fm3_10.el9.noarch
rubygem-foreman_maintain-1.5.1-1.el9.noarch
Distribution and version:
rocky 9.0
Other relevant data: