Open dyioulos opened 6 years ago
Please look in https://github.com/Batix/rundeck-ansible-plugin/tree/master/src/main/resources. These files are used by Rundeck to import the inventory. You should get a directory with files containing the variables and facts of each node. Please add these files to your Ansible inventory, setting additional variables as below:
Variable | Value |
---|---|
tmpdir |
A temporary directory of your choosing |
facts |
yes |
System: CentOS 7 Rundeck: 3.0.5 Ansible: 2.3.2.0-2.el7.noarch
Created a project as follows:
Wed Aug 29 16:04:21 EDT 2018
edit below
ansible-become-method=sudo ansible-become-user=a-scripting ansible-become=true ansible-ssh-auth-type=password ansible-ssh-user=a-scripting project.ansible-become-method=sudo project.ansible-become-user=a-scripting project.ansible-become=true project.ansible-config-file-path=/etc/ansible/ansible.cfg project.ansible-executable=/bin/bash project.ansible-ssh-auth-type=password project.ansible-ssh-user=a-scripting project.ansible-windows-executable=cmd.exe project.description= project.disable.executions=false project.disable.schedule=false project.jobs.gui.groupExpandLevel=1 project.label= project.name=Linux_Nodes project.nodeCache.delay=30 project.nodeCache.enabled=true project.nodeCache.firstLoadSynch=true project.ssh-authentication=privateKey project.ssh-keypath=/var/lib/rundeck/.ssh/id_rsa resources.source.1.type=local resources.source.2.config.ansible-become-password=***** resources.source.2.config.ansible-become-user=a-scripting resources.source.2.config.ansible-become=false resources.source.2.config.ansible-config-file-path=/etc/ansible/ansible.cfg
and a source built with "Ansible Resource Model Source", I get no nodes listed except for the local node. The command "su rundeck -s /bin/bash -c "ansible all -m ping"" produces the expected output. Here's output from /var/log/rundeck/service.log:
ERROR ExceptionCatchingResourceModelSource: [ResourceModelSource: 2.source (com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory), project: Nodes] com.dtolabs.rundeck.core.resources.ResourceModelSourceException: ERROR: Ansible execution returned with non zero code. at com.batix.rundeck.plugins.AnsibleResourceModelSource.getNodes(AnsibleResourceModelSource.java:253) at com.dtolabs.rundeck.core.resources.ExceptionCatchingResourceModelSource.getNodes(ExceptionCatchingResourceModelSource.java:57) at com.dtolabs.rundeck.core.common.ProjectNodeSupport$LoadedSource.getNodes(ProjectNodeSupport.java:456) at com.dtolabs.rundeck.core.common.ProjectNodeSupport.getNodeSet(ProjectNodeSupport.java:138) at com.dtolabs.rundeck.core.common.ProjectNodeSupport$ProjectNodesSource.getNodes(ProjectNodeSupport.java:365) at com.dtolabs.rundeck.core.resources.ExceptionCatchingResourceModelSource.getNodes(ExceptionCatchingResourceModelSource.java:57) at com.dtolabs.rundeck.core.resources.ResourceModelSource$getNodes.call(Unknown Source) at rundeck.services.nodes.CachedProjectNodes.reloadNodeSet(CachedProjectNodes.groovy:44) at rundeck.services.nodes.CachedProjectNodes$reloadNodeSet.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at rundeck.services.NodeService$_loadNodes_closure5.doCall(NodeService.groovy:290) at rundeck.services.NodeService$_loadNodes_closure5.doCall(NodeService.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.Closure.call(Closure.java:418) at groovy.lang.Closure.call(Closure.java:412) at com.codahale.metrics.Timer.time(Timer.java:99) at com.codahale.metrics.Timer$time$0.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at com.codahale.metrics.Timer$time$0.call(Unknown Source) at org.grails.plugins.metricsweb.MetricService.withTimer(MetricService.groovy:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:190) at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:144) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:104) at rundeck.services.NodeService.loadNodes(NodeService.groovy:302) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:95) at rundeck.services.NodeService.this$dist$invoke$1(NodeService.groovy) at rundeck.services.NodeService$3.methodMissing(NodeService.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:951) at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1279) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1227) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:822) at rundeck.services.NodeService$3.invokeMethod(NodeService.groovy) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:398) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:338) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177) at rundeck.services.NodeService$3$_reload_closure1.doCall(NodeService.groovy:138) at rundeck.services.NodeService$3$_reload_closure1.doCall(NodeService.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.Closure.call(Closure.java:418) at groovy.lang.Closure.call(Closure.java:412) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.springframework.core.task.SimpleAsyncTaskExecutor$ConcurrencyThrottlingRunnable.run(SimpleAsyncTaskExecutor.java:271) at java.lang.Thread.run(Thread.java:748) Caused by: com.batix.rundeck.core.AnsibleException: ERROR: Ansible execution returned with non zero code. at com.batix.rundeck.core.AnsibleRunner.run(AnsibleRunner.java:508) at com.batix.rundeck.plugins.AnsibleResourceModelSource.getNodes(AnsibleResourceModelSource.java:251) ... 80 more WARN LoggingResourceModelSourceCache: [ResourceModelSource: 2.source (com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory), project: Nodes] Returning cached model data