Using Rundeck as a GUI for ansible?

1,310 views
Skip to first unread message

David Elizalde

unread,
Aug 9, 2016, 1:48:21 PM8/9/16
to rundeck-discuss
Hello all, i know it is possible to use rundeck as an interface to ansible, however i'm having a problem where execution of ansible via rundeck fails.
I am using the ansible-plugin for rundeck to execute playbooks/modules but no matter what i try the execution is not successful as it complains about the node "is not reachable through ssh".

i'm suspecting this is because my localhost is executing the ansible commands as the rundeck user (even if i specify my username and ssh keys in the ansible host file).

I know it's probably a dumb question but i'm fairly new to rundeck+ansible. but is there a way i can install the rundeck user in my node and use the ssh keys its using? Or any tips or guides i can use to use rundeck+ansible?

Thanks!

Alex Honor

unread,
Aug 9, 2016, 1:49:33 PM8/9/16
to rundeck...@googlegroups.com
Hi David,

I'm not quite sure what is preventing it. Have you posted this as an issue at https://github.com/Batix/rundeck-ansible-plugin ?

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/7e40b733-e299-47c8-8392-ca7749bb263a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[SimplifyOps, Inc | a...@simplifyops.com ]

Be sure to comment and vote on Rundeck Feature Development!

David Elizalde

unread,
Aug 9, 2016, 2:04:52 PM8/9/16
to rundeck-discuss
Hello Alex,

No, i haven't posted the issue there. Here's an example output i'm getting if i run "ansible all -m ping" command from rundeck:

12:59:26localhostUsing /etc/ansible/ansible.cfg as config file
12:59:26<node1> ESTABLISH SSH CONNECTION FOR USER: elizaldd
12:59:26<node> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/elizaldd/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=elizaldd -o ConnectTimeout=10 -o ControlPath=/var/lib/rundeck/.ansible/cp/ansible-ssh-%h-%p-%r node1 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python && sleep 0'"'"''
12:59:26node1 | UNREACHABLE! => {
12:59:26 "changed": false,
12:59:26 "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
12:59:26 "unreachable": true
12:59:26}


And this is the output if run the same command from the command line:

Using /etc/ansible/ansible.cfg as config file
<node1> ESTABLISH SSH CONNECTION FOR USER: elizaldd
<node1> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/elizaldd/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=elizaldd -o ConnectTimeout=10 -o ControlPath=/home/elizaldd/.ansible/cp/ansible-ssh-%h-%p-%r node1 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python && sleep 0'"'"''
node1 | SUCCESS => {
    "changed": false,
    "invocation": {
        "module_args": {
            "data": null
        },
        "module_name": "ping"
    },
    "ping": "pong"
}

On Tuesday, 9 August 2016 12:49:33 UTC-5, Alex Honor wrote:
Hi David,

I'm not quite sure what is preventing it. Have you posted this as an issue at https://github.com/Batix/rundeck-ansible-plugin ?
On Tue, Aug 9, 2016 at 10:47 AM, David Elizalde <david.eli...@gmail.com> wrote:
Hello all, i know it is possible to use rundeck as an interface to ansible, however i'm having a problem where execution of ansible via rundeck fails.
I am using the ansible-plugin for rundeck to execute playbooks/modules but no matter what i try the execution is not successful as it complains about the node "is not reachable through ssh".

i'm suspecting this is because my localhost is executing the ansible commands as the rundeck user (even if i specify my username and ssh keys in the ansible host file).

I know it's probably a dumb question but i'm fairly new to rundeck+ansible. but is there a way i can install the rundeck user in my node and use the ssh keys its using? Or any tips or guides i can use to use rundeck+ansible?

Thanks!

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.

David Elizalde

unread,
Aug 9, 2016, 2:06:48 PM8/9/16
to rundeck-discuss
I already tried the instructions in the requirements section of the ansible-plugin github page "If it complains, chances are that your rundeck $HOME directory isn't writable by Rundeck, fix it with e.g. chown rundeck /var/lib/rundeck (see this issue)"

Peter Garlic

unread,
Aug 10, 2016, 11:04:28 AM8/10/16
to rundeck-discuss
Hi
there is a really dirty trick that you can use while you find the right solution for your systems. I´ve used them before to find the right solution on our infrastructure that include different users, ssh bastions and so on.

Try to:

- add your ansible user on sudoers with no password request (as example the user: MyAnsibleUser)
- use this syntax for ansible commands:
sudo -H -u MyAnsibleUser -S bash -c '''/usr/bin/ansible all -m ping'''
( remember to use the 3 quotes  before and after the command for rundeck quoting)

:/ I know sound really bad, but better than nothing to start testing

-Peter

Peter Garlic

unread,
Aug 11, 2016, 2:38:22 AM8/11/16
to rundeck-discuss
Wops. I have wrote a wrong user....
 
- add your rundeck user to sudoers (so it can switch to MyAnsibleUser)

David Elizalde

unread,
Aug 11, 2016, 2:58:11 PM8/11/16
to rundeck-discuss
Thank you so much Peter! Even if it's not optimal that did the trick and now was able to successfully run an ansible command through rundeck!

Peter Garlic

unread,
Aug 12, 2016, 4:19:04 AM8/12/16
to rundeck-discuss
You are welcome!
Enjoy with ansible and have a nice w.e.
-Peter
Reply all
Reply to author
Forward
0 new messages