rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
331 stars 100 forks source link

Unable to connect when using ansible_ssh_pass #235

Open craph opened 5 years ago

craph commented 5 years ago

Hello,

I am unable to view my nodes in the rundeck interface. I have create as mention in the documentation an inventory.ini file like this :

[test-group]
local-thing      ansible_connection=local      ansible_python_interpreter=/usr/bin/python3
my-first-server  ansible_host=1.2.3.4          ansible_user=root    ansible_ssh_pass=SUPER_SECRET

But I have the following error in the log of rundeck : FAILED! => {"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"

but when I connect to the docker container I cannot install sshpass because I don't have the password for the sudo...

Can you help me ?

Best regards,

craph commented 5 years ago

The package sshpass is missing in the DockerFile. Could you add it please ?

Thank you very much.

frozenice commented 5 years ago

Done. Can you try with 3.0.1?

zopar commented 5 years ago

It is strange how the plugin set the ansible command. If you select to use password and set an user, the command will use --ask-password and the ansible-playbook command hangs because rundeck do not answer to the prompt "SSH password:" generated by ansible. If you omit the password inside rundek interface, the plugin completely ignore ssh user and password set in the hosts.ini I think because it pass the extra var file that is in tmp Basically it is not possible to correctly setup a connection with user and password defined in the hosts.ini We need to pass in any case an hosts.ini why you do not simplify things and launch only the ansible-playbook and keep users to manage autentication via standard hosts.ini vars and ansible.cfg?

zopar commented 5 years ago

Ok I confirm the issue: you pass extra vars in your command, this take precedence over ansible_ssh_user and password set in hosts.ini. For example if you set gather fact this include the extra vars and does not works, if you remove gather facts, it works because you do not set extra vars and ansible uses user and password from hosts.ini . If you set the password inside rundeck, the command use --ask-pass and this is incorrect because this prompt password and you do not want this because you are in "background" not in a terminal.

Possible fix: if an user select to use, user and password, do not use --ask-pass but insert the user and password inside your extra vars file, so user do not needs to specify it on hosts.ini But remember this limit the possibility to specify multiple user and password by ansible groups.

I think the better option is to disable this type of options from interface and simply use classical hosts.ini that is more flexible.

craph commented 4 years ago

Any news on this issue ?