Uknown
February 18, 2019, 1:36pm
#1
Problem:
Hello,
If i run ansible roles from foreman always the root user will used.
Errormessage:
Error initializing command: Net::SSH::AuthenticationFailed - Authentication failed for user root@testvm.test.tc
I set a few hostparameter but they will be ignored.
Host Parameters for testvm.test.tc (linux VM):
ansible_user: ansible
ansible_password: xxxxxxxx
I can see in foreman_params my parameters are correctly included but the ssh_connection
its always with the user root.
I have tried a lot off things but nothing helps. I create my own job-template with
vars:
ansible_user: ‘ansible’
ansible_password: ‘xxxxxxxxx’
without success.
Expected outcome:
Play ansible roles correctly
Foreman and Proxy versions:
foreman 1.21.0~rc4-1
foreman-proxy 1.21.0~rc4-1
Foreman and Proxy plugin versions:
ruby-foreman-ansible 2.3.1-1
Any idea?
Please help
mobios
Can you try changing Settings -> Remote execution -> remote_execution_ssh_user or using “remote_execution_ssh_user” as the parameter name? That should work.
Hope this helps
Uknown
February 19, 2019, 7:42am
#3
Hello Marek,
i set via host parameter “remote_execution_ssh_user = ansible” but dont helps.
You can see on snippet below (foreman_params)
"foreman_params\":{\"remote_execution_ssh_user\":\"ansible\",\"remote_execution_effective_user_method\":\"sudo\",\"remote_execution_connect_by_ip\":false},\"foreman_ansible_roles\":[\"test_update_sources\"],\"ansible_connection\":\"ssh\"
Same time i edited the settings -> RemoteExecution with no success.
hm, then it sounds as a bug that we’ll need to look at, would you mind opening redmine issue for this?
Uknown
February 19, 2019, 10:43am
#5
Hello Marek,
after a few reboots off ansible server the error :
Error initializing command: Net::SSH::AuthenticationFailed - Authentication failed for user root@testvm.test.tc
its not present anymore.
But the tasks what i execute are running permanently.
I can see in /var/log/foreman-proxy/proxy.log
2019-02-19T11:17:55 [D] Executor heartbeat
2019-02-19T11:18:10 [D] Executor heartbeat
2019-02-19T11:18:25 [D] Executor heartbeat
2019-02-19T11:18:40 [D] Executor heartbeat
2019-02-19T11:18:55 [D] Executor heartbeat
2019-02-19T11:19:10 [D] Executor heartbeat
2019-02-19T11:19:25 [D] Executor heartbeat
2019-02-19T11:19:40 [D] Executor heartbeat
2019-02-19T11:19:55 [D] Executor heartbeat
2019-02-19T11:20:10 [D] Executor heartbeat
2019-02-19T11:20:25 [D] Executor heartbeat
2019-02-19T11:20:40 [D] Executor heartbeat
2019-02-19T11:20:55 [D] Executor heartbeat
2019-02-19T11:21:10 [D] Executor heartbeat
2019-02-19T11:21:25 [D] Executor heartbeat
2019-02-19T11:21:40 [D] Executor heartbeat
2019-02-19T11:21:55 [D] Executor heartbeat
2019-02-19T11:22:10 [D] Executor heartbeat
2019-02-19T11:22:25 [D] Executor heartbeat
2019-02-19T11:22:40 [D] Executor heartbeat
In dynflow console
|I d |Label |State |Result |▼ Started at ||
|---|---|---|---|---|---|
|6b015db4-30f7-48ff-ab03-c3360dc8a238 |Dynflow::ActiveJob::QueueAdapters::JobWrapper |scheduled |pending ||Show|
|96b99924-b0c5-4489-8639-c86cf717b4ed |Dynflow::ActiveJob::QueueAdapters::JobWrapper |scheduled |pending ||Show|
|824b8baf-ca32-42ec-9308-d6e6e264cd3d |Dynflow::ActiveJob::QueueAdapters::JobWrapper |scheduled |pending ||Show|
|9b379dea-cf79-475c-95b9-84db59743f87 |Dynflow::ActiveJob::QueueAdapters::JobWrapper |scheduled |pending ||Show|
|4d01080a-e779-4219-a2d9-ff83afb626b4 |Dynflow::ActiveJob::QueueAdapters::JobWrapper |scheduled |pending ||Show|
|cf08c97d-6459-44df-bb75-c18588f79479 |Dynflow::ActiveJob::QueueAdapters::JobWrapper |scheduled |pending ||Show|
|2e1b3119-434d-47ad-8dec-28c3a1b6cdad |Actions::RemoteExecution::RunHostJob |running |pending |2019-02-19 10:15:39 UTC |Show|
|df65c4df-3ffc-4e05-83f4-b6d5a3c93d29 |Actions::RemoteExecution::RunHostsJob |running |pending |2019-02-19 10:15:39 UTC |Show|
|4e6b6d05-45ba-4f15-87ce-63fb28c61da4 |Actions::RemoteExecution::RunHostJob |running |pending |2019-02-19 09:52:36 UTC |Show|
|1972bdfb-c746-4737-a948-bc933ca35252 |Actions::RemoteExecution::RunHostsJob |running |pending |2019-02-19 09:52:35 UTC |Show|
/etc/foreman-proxy/settings.d/dynflow.yml
—
:enabled: true
:database: /var/lib/foreman-proxy/dynflow/dynflow.sqlite
:core_url: ‘http://127.0.0.1:8008 ’
netstat -an | grep 8008 (nothing found should port 8008 open?)
netstat -an | grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
/etc/foreman-proxy/settings.d/remote_execution_ssh.yml
—
:enabled: true
:ssh_identity_key_file: ‘~/.ssh/id_rsa_foreman_proxy’
:local_working_dir: ‘/var/tmp’
:remote_working_dir: ‘/var/tmp’
# :kerberos_auth: false
# :async_ssh: false
# Defines how often (in seconds) should the runner check
# for new data leave empty to use the runner's default
# (1 second for regular, 60 seconds with async_ssh enabled)
# :runner_refresh_interval:
# Defines the verbosity of logging coming from Net::SSH
# one of :debug, :info, :warn, :error, :fatal
# must be lower than general log level
:ssh_log_level: :debug
Do i something wrong?
Uknown
February 20, 2019, 7:52am
#6
After fresh installation the issue is gone. Thanks for help