ansible-plugin icon indicating copy to clipboard operation
ansible-plugin copied to clipboard

Ansible hosts with non-standard ssh port

Open tazmad opened this issue 6 years ago • 13 comments

Hi there,

I'm trying to setup rundeck with ansible and so far I have been partially successful. The ansible hosts are correctly all detected and imported as nodes, however the hosts which are not using the standard port 22 for ssh have their port missing and I cannot see any option for specifying this.

I have tried setting the "extra ansible arguements" with "-e ansible_port=999", but this results in the job failing with the error "ERROR! the playbook: ansible_port=999 could not be found 23:08:23 Failed: AnsibleNonZero: ERROR: Ansible execution returned with non zero code."

Any help would be much appreciated.

tazmad avatar May 27 '19 22:05 tazmad

I forgot to mention that within the ansible host file the server is defined as servername:port

tazmad avatar May 27 '19 22:05 tazmad

https://docs.rundeck.com/docs/administration/projects/node-execution/ssh.html

I'm trying to figure this out now.

It looks like rundeck's ansible node plugin is not importing the ssh port.

xpufx avatar Mar 29 '20 23:03 xpufx

any news about this topic. If I define the port as mention in docs it cannot resolve the hostname.

hesne avatar Jan 12 '21 13:01 hesne

running currently in the same issue... Since in my case it´s only one node I could add it to a Rundeck Node File but ofc this is not the nice way.

Scifire avatar Jan 19 '21 09:01 Scifire

I am running into the same problem. I am currently evaluating ansible+rundeck (to replace awx) for our company. However, all our servers are running ssh on the (same) non-standard port. So currently it looks to me as if the evaluation just failed... Unless there is any news on this topic?

I see there is an open pull request in this direction: https://github.com/Batix/rundeck-ansible-plugin/pull/281 That would at least be a functional workaround.

What would be really ideal though, would be just honoring the setting from ansible.cfg, which is read in after all:

[ssh_connection] remote_port = an_integer

It seems pretty weird to me that rundeck itself doesn't have a setting for the standard ssh setting, just allowing overriding per host (which isn't discovered yet, so not an option), but that is of course outside of the scope of this plugin.

martin-gerdes avatar Aug 02 '21 08:08 martin-gerdes

Workaround found, for our usecase of that ssh port being the same for all servers: echo " Port an_integer" >> /etc/ssh/ssh_config

This doesn't help if any servers had a different ssh port, so this issue still deserves to stay open. But at least for our use case, this is good enough. :-)

martin-gerdes avatar Aug 03 '21 09:08 martin-gerdes

any update on this issue?

CorvetteCole avatar Mar 07 '22 20:03 CorvetteCole

I can confirm, that this issue still exists, have one server in wan, which has non default ssh-port and: ansible -m shell -a id myhost works, but adhoc id comand fails in rundeck. Would be great to have this issue get fixed one time

joe-speedboat avatar Oct 03 '22 08:10 joe-speedboat