Closed Gmyras closed 8 years ago
Hello. Im getting same error. Plugin v.1.2.3, rundeck 2.6.7, Ubuntu 14.04 In rundeck logs I have this:
...
com.dtolabs.rundeck.core.resources.ResourceModelSourceException: Error reading facts.
...
Caused by: java.nio.file.NoSuchFileException: /tmp/rundeck/ansible-hosts8239116568217565068/data
...
I tried: su rundeck -s /bin/bash -c "ansible-playbook /tmp/rundeck/ansible-hosts8239116568217565068/gather-hosts.yml" Got this:
...
TASK [file] ********************************************************************
fatal: [hostname.mydomain.com]: FAILED! => {"failed": true, "msg": "'tmpdir' is undefined"}
...
Also no "data" directory in /tmp/rundeck/ansible-hosts8239116568217565068/ in /tmp/rundeck/ansible-hosts8239116568217565068/ I have that odd directory $HOME/.ansible/ in /tmp/rundeck/ansible-hosts8823821777267040669/
Then I tried: su rundeck -s /bin/bash -c "ansible-playbook /tmp/rundeck/ansible-hosts8823821777267040669/gather-hosts.yml -e 'tmpdir=/tmp/rundeck/ansible-hosts8239116568217565068/'" And everything went fine, "data" directory was created in /tmp/rundeck/ansible-hosts8239116568217565068/.
Please provide any help.
I am using 1.2.4, i have the same issue.
the error is:
TASK [setup] *******************************************************************
fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
fatal: [host2]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
to retry, use: --limit @gather-hosts.retry
PLAY RECAP *********************************************************************
host1 : ok=0 changed=0 unreachable=1 failed=0
host2 : ok=0 changed=0 unreachable=1 failed=0
but when running ansible all -m ping
all host are reachable. is it because rundeck is using rundeck user to run instead of root? or because of SSH keys issue? i have no idea how to fix it.
@lunawesley9 Ansible needs to run under the rundeck user, see the README and see if the su
command there works, if not you need to fix the permissions.
I had this error:
UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"
echo $HOME/.ansible/tmp/ansible-tmp-1465291130.42-184715713825092
\" && echo ansible-tmp-1465291130.42-184715713825092=\"echo $HOME/.ansible/tmp/ansible-tmp-1465291130.42-184715713825092
\" ), exited with result 1", "unreachable": true} UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"echo $HOME/.ansible/tmp/ansible-tmp-1465291130.42-184715713825092
\" && echo ansible-tmp-1465291130.42-184715713825092=\"echo $HOME/.ansible/tmp/ansible-tmp-1465291130.42-184715713825092
\" ), exited with result 1", "unreachable": true}
And had to change the remote tmp dir in ansible config
@frozenice the node list cannot be retrieved unless i run the rundeckd as root
do i need to fix any ssh keys anywhere?
@lunawesley9 Well Ansible is started under the same user that rundeck runs under, so you need to make sure Ansible can actually run successfully under the rundeck user. The README I linked above has some hints and also a command to test if it works (su
) and that gives you some error details if it doesn't.
@frozenice I checked that it is successful in CLI?
[rundeck@localhost playbook]$ ansible all -m ping -u root
host1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
host2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[rundeck@localhost playbook]$ vim setup.yml
@lunawesley9 Does it also work without the -u root
option? This option doesn't get added automatically by the plugin and you'd need to add it as an extra argument to jobs etc., if needed.
What exactly isn't working in Rundeck? See the README on how to enable debug mode, this might give you more information.
@frozenice but the root is the user in the remote host? and the ansible palybooks actually is :
- name: Task1
hosts: host1
user: root
gather_facts: no
so the script will need to run as root anyway?
@lunawesley9 Please try whatever you do in Rundeck with debug mode enabled (see README of this plugin) and post the complete log.
@frozenice all logs actually shows node not found and even in the GUI it isn't listing out any nodes. which log will have the node loading logs?
all logs are like this mentioning no valid nodes:
17:13:10 localhost com.dtolabs.rundeck.core.NodesetEmptyException: No matched nodes: NodeSet{includes={name=.*, dominant=false, }}
17:13:10 at com.dtolabs.rundeck.core.execution.workflow.NodeFirstWorkflowStrategy.validateNodeSet(NodeFirstWorkflowStrategy.java:350)
17:13:10 at com.dtolabs.rundeck.core.execution.workflow.NodeFirstWorkflowStrategy.executeWorkflowImpl(NodeFirstWorkflowStrategy.java:88)
17:13:10 at com.dtolabs.rundeck.core.execution.workflow.BaseWorkflowStrategy.executeWorkflow(BaseWorkflowStrategy.java:182)
17:13:10 at com.dtolabs.rundeck.core.execution.WorkflowExecutionServiceThread.run(WorkflowExecutionServiceThread.java:55)
17:13:10 Exception: class com.dtolabs.rundeck.core.NodesetEmptyException: No matched nodes: NodeSet{includes={name=.*, dominant=false, }}
17:13:10 No matched nodes: NodeSet{includes={name=.*, dominant=false, }}
@lunawesley9 You need to set a Java system property as per https://github.com/Batix/rundeck-ansible-plugin/#debugging - you should then restart Rundeck, which should re-import your nodes. After this, there should be some stuff in service.log
(depends on your installation method).
@frozenice
the ssh seems failed to authenticate but when i use rundeck user to ssh in in CLI it is ok .
PLAYBOOK: gather-hosts.yml *****************************************************
1 plays in gather-hosts.yml
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
<host1> ESTABLISH SSH CONNECTION FOR USER: None
<host1> SSH: ansible.cfg set ssh_args: (-o)(ControlMaster=auto)(-o)(ControlPersist=60s)
<host1> SSH: ansible_password/ansible_ssh_pass not set: (-o)(KbdInteractiveAuthentication=no)(-o)(PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey)(-o)(PasswordAuthentication=no)
<host1> SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)
<host1> SSH: PlayContext set ssh_common_args: ()
<host1> SSH: PlayContext set ssh_extra_args: ()
<host1> SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/var/lib/rundeck/.ansible/cp/ansible-ssh-%h-%p-%r)
<host1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/var/lib/rundeck/.ansible/cp/ansible-ssh-%h-%p-%r host1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1465382248.38-233275575587618 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1465382248.38-233275575587618 `" )'"'"''
Huh, is that all log output? There's no error.
But it doesn't seem right, either. The user is "None" and there is no reference to a keyfile. Something is strange with your Ansible config. Maybe the rundeck user is missing some environment variables or something like that?
Can you please try su rundeck -s /bin/bash -c "ansible all -m ping"
as root? Don't switch the user to rundeck and run ansible there, but use this command as root, please.
@frozenice actually the SSH command auth fails. why isn't the command
ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/var/lib/rundeck/.ansible/cp/ansible-ssh-%h-%p-%r host1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1465382248.38-233275575587618 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1465382248.38-233275575587618 `" )'"'"''
root@host1
but only host1
as the ansible playbook should be running as root in root host according to the script?
@frozenice
su rundeck -s /bin/bash -c "ansible all -m ping"
this fails, as my ansible script should login to remote hosts as root?
@frozenice
update. I got that fixed. sorry about that in ansible.cfg
# default user to use for playbooks if user is not specified
# (/usr/bin/ansible will use current user as default)
remote_user = root
i didn't enable it before --- it was fresh installation
thanks for your help and pointing the issue to ansible.cfg!
No problem, glad you got it working. :)
Closing this issue now. If anyone still has a problem, please open a new issue including the debug output.
I would very much like to have this issue reopened. I don't think it should be necessary to provide new logs here. Since this bug is still in Rundeck and is not really well documented in the manuals.
To be honest, I think it is a design flaw of the Rundeck application or i am stupid. Maybe I am wrong here, but then you can correct me here. I'm still relatively new to Rundeck and the documentation is unfortunately very unclear about this problem or doesn't even mention it. This could at least be changed.
@frozenice
@oevcil I can't help you, because I'm not maintaining this plugin anymore (see README), sorry.
@frozenice oh i am sorry. But thank you for the reply!
Hello, I'm getting a similar error like the other issues.
I'm in AWS and using dynamic list script.
Rundeck user can run ansible fine.
Also I tried to use a single node hosts ansible file.
Same result.
What can I check more to get it working?