Open odg0318 opened 5 years ago
Can you try using ansible-ssh-user
instead of username
? If it works correctly then that's great, but it's a bug at that rate.
@mcassaniti I tried using ansible-ssh-user
but it doesn't work. But when I removed default ssh user in job setting, it woks well. Thanks.
I'm going to re-open this as it is a bug. What should happen in the following order is:
ansible-ssh-user
is specified against the node then use itusername
is specified against the node then use itI don't believe that last case is being met. It seems to be a problem (partially) in PropertyResolver.java. Might need to add an alias somehow.
@mcassaniti I have a question of setting ssh username via ansible.
I want to change ansible-ssh-user
when I execute a job.
I checked the following code.
https://github.com/Batix/rundeck-ansible-plugin/blob/v2.1.3/src/main/java/com/batix/rundeck/core/AnsibleRunnerBuilder.java#L263
getSshUser()
returns ssh username from a job config.
To do that, I should set ansible-ssh-user
, AnsibleDescribable.ANSIBLE_SSH_USER
in code, when I execute a job.
But I don't know how to set and pass ansible-ssh-user
to a job via the following rundeck API.
https://rundeck.org/docs/api/#running-a-job
Parameters available to set belong to options
. No parameter is found to pass ansible-ssh-user
.
In codes, it seems available to set ansible-ssh-user
when a job is executed.
I set nodes source from
json
Resource Model as you can see in https://rundeck.org/2.11.6/man5/resource-json.html.username
is described as below.And the json is written as below
And I set SSH user to
ansible
onEdit Configuration > Default Node Executor > Ansible Ad-Hoc Node Executor > SSH Connection > SSH User
.Under the environment,
server1
cannot be accessed butserver2
can be accessed. It seems thatusername
in Resource Model is not used as ssh user.How can I change an username used to connect via ssh?
Thanks