rundeck-plugins / ansible-plugin

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

Running on windows nodes reports module missing? #190

Open nublaii opened 6 years ago

nublaii commented 6 years ago

Hi

I just setup a new server to be able to run ansible 'natively' from rundeck.

I have set up a project only for my windows machines.

I setup the executor, file copier and node source to use ansible, and so far so good.

The structure I am using to keep all my ansible-related files are inside /scripts/, following this hierarchy:

image

Well... for the life of me I can't get it to run anything (I have tried ansible modules, ad-hoc, inline playbook and playbook).

This is the error I get when I try to run win_ping for example:

Execution failed: 47 in project windows: [Workflow result: , step failures: {1=PluginFailed: null}, status: failed]

And this is the whole log

[workflow] Begin execution: node-first
Start EngineWorkflowExecutor
Building initial state and rules...
Update conditional state: {before.step.1=true, after.step.1=false}
start conditions for step [1]: []
Create rule engine with rules: RuleEngine{ruleSet=[Rule: Conditions([(step.any.state.failed == 'true'), (workflow.keepgoing == 'false')]) => DataState{state={workflow.done=true}}, Rule: Conditions([(step.any.flowcontrol.halt == 'true')]) => DataState{state={workflow.done=true}}, Rule: Conditions([]) => DataState{state={step.1.start=true}}]}
Create workflow engine with state: StateLogger{state=DataState{state={job.successOnEmptyNodeFilter=false, job.executionType=user, job.url=http://rundeck.server:4440/project/windows/execution/follow/47, job.filter=.*, job.id=e0708c40-9799-4a5a-af22-f1670e06bb56, job.loglevel=DEBUG, job.wasRetry=false, job.project=windows, before.step.1=true, after.step.1=false, job.retryInitialExecId=0, job.username=admin, job.retryAttempt=0, job.user.name=admin, workflow.keepgoing=true, job.execid=47, job.serverUrl=http://rundeck.server:4440/, job.name=win_ping, job.threadcount=1}}}
Begin: Workflow begin
WillProcessStateChange: saw state changes: {workflow.state=started}
Update conditional state: {workflow.state=started}
Update conditional state: {step.1.start=true}
DidProcessStateChange: applied state changes and rules (changed? true): StateLogger{state=DataState{state={job.successOnEmptyNodeFilter=false, job.executionType=user, job.url=http://rundeck.server:4440/project/windows/execution/follow/47, job.filter=.*, job.id=e0708c40-9799-4a5a-af22-f1670e06bb56, job.loglevel=DEBUG, job.wasRetry=false, job.project=windows, before.step.1=true, step.1.start=true, after.step.1=false, workflow.state=started, job.retryInitialExecId=0, job.username=admin, job.retryAttempt=0, job.user.name=admin, workflow.keepgoing=true, job.execid=47, job.serverUrl=http://rundeck.server:4440/, job.name=win_ping, job.threadcount=1}}}
WillRunOperation: operation starting: Step{stepNum=1, label='null'}
LoopProgress: Pending(1) => run(1), skip(0), remain(0)
[workflow] Begin step: 1,com.batix.rundeck.plugins.AnsibleModuleWorkflowStep
1: Workflow step executing: StepExecutionItem{type='com.batix.rundeck.plugins.AnsibleModuleWorkflowStep', keepgoingOnSuccess=false, hasFailureHandler=false}
Failed executing step plugin [com.batix.rundeck.plugins.AnsibleModuleWorkflowStep]: java.lang.NullPointerException
    at com.batix.rundeck.core.AnsibleRunnerBuilder.getInventory(AnsibleRunnerBuilder.java:700)
    at com.batix.rundeck.core.AnsibleRunnerBuilder.buildAnsibleRunner(AnsibleRunnerBuilder.java:819)
    at com.batix.rundeck.plugins.AnsibleModuleWorkflowStep.executeStep(AnsibleModuleWorkflowStep.java:74)
    at com.dtolabs.rundeck.core.execution.workflow.steps.StepPluginAdapter.executeWorkflowStep(StepPluginAdapter.java:114)
    at com.dtolabs.rundeck.core.execution.ExecutionServiceImpl.executeStep(ExecutionServiceImpl.java:103)
    at com.dtolabs.rundeck.core.execution.workflow.BaseWorkflowExecutor.executeWFItem(BaseWorkflowExecutor.java:291)
    at com.dtolabs.rundeck.core.execution.workflow.BaseWorkflowExecutor.executeWorkflowStep(BaseWorkflowExecutor.java:687)
    at com.dtolabs.rundeck.core.execution.workflow.engine.StepCallable.apply(StepCallable.java:71)
    at com.dtolabs.rundeck.core.execution.workflow.engine.StepOperation.apply(StepOperation.java:73)
    at com.dtolabs.rundeck.core.execution.workflow.engine.StepOperation.apply(StepOperation.java:31)
    at com.dtolabs.rundeck.core.rules.WorkflowEngineOperationsProcessor.lambda$processRunnableOperations$31(WorkflowEngineOperationsProcessor.java:222)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

1: Workflow step finished, result: PluginFailed: null
[workflow] Finish step: 1,com.batix.rundeck.plugins.AnsibleModuleWorkflowStep
OperationSuccess: operation succeeded: StepSuccess{stepNum=1, stepResultCapture=StepResultCapture{stepResult=PluginFailed: null, stepSuccess=false, statusString='null', controlBehavior=PluginFailed: null, resultData=MultiDataContextImpl(map={}, base=null)}, newState=DataState{state={step.1.completed=true, step.any.state.failed=true, before.step.1=false, step.1.state=failure, after.step.1=true}}}
WillProcessStateChange: saw state changes: {before.step.1=false, step.1.state=failure, after.step.1=true, step.1.completed=true, step.any.state.failed=true}
Update conditional state: {before.step.1=false, step.1.state=failure, after.step.1=true, step.1.completed=true, step.any.state.failed=true}
Update conditional state: {step.1.start=true}
DidProcessStateChange: applied state changes and rules (changed? true): StateLogger{state=DataState{state={job.successOnEmptyNodeFilter=false, job.executionType=user, job.url=http://rundeck.server:4440/project/windows/execution/follow/47, job.filter=.*, job.id=e0708c40-9799-4a5a-af22-f1670e06bb56, step.1.completed=true, step.any.state.failed=true, job.loglevel=DEBUG, job.wasRetry=false, job.project=windows, before.step.1=false, step.1.start=true, after.step.1=true, workflow.state=started, job.retryInitialExecId=0, job.username=admin, job.retryAttempt=0, job.user.name=admin, workflow.keepgoing=true, job.execid=47, job.serverUrl=http://rundeck.server:4440/, job.name=win_ping, step.1.state=failure, job.threadcount=1}}}
LoopProgress: Pending(0) => run(0), skip(0), remain(0)
EndOfChanges: No more state changes expected, finishing workflow.
WillShutdown: Workflow engine shutting down
Complete: Workflow complete: [Step{stepNum=1, label='null'}: StepSuccess{stepNum=1, stepResultCapture=StepResultCapture{stepResult=PluginFailed: null, stepSuccess=false, statusString='null', controlBehavior=PluginFailed: null, resultData=MultiDataContextImpl(map={}, base=null)}, newState=DataState{state={step.1.completed=true, step.any.state.failed=true, before.step.1=false, step.1.state=failure, after.step.1=true}}}]
[workflow] Finish execution:  node-first: [Workflow result: , step failures: {1=PluginFailed: null}, status: failed]
[Workflow result: , step failures: {1=PluginFailed: null}, status: failed]
Execution failed: 47 in project windows: [Workflow result: , step failures: {1=PluginFailed: null}, status: failed]

I do get rundeck to import all the windows nodes correctly, so I don't know what I'm doing wrong.

nublaii commented 6 years ago

Some more logs

==> /var/log/rundeck/service.log <==
ERROR ExecutionUtilService: Execution failed: 49 in project windows: [Workflow result: , step failures: {1=PluginFailed: null}, status: failed]
==> /var/log/rundeck/rundeck.log <==
2018-05-29 17:15:51,283 [quartzScheduler_Worker-8] ERROR grails.app.services.rundeck.services.ExecutionUtilService - Execution failed: 49 in project windows: [Workflow result: , step failures: {1=PluginFailed: null}, status: failed]

And these are the settings on the job:

image

nublaii commented 6 years ago

And here the project config:

node executor : image

file copier: image

And the node sources: image

mcassaniti commented 6 years ago

Thanks for all the screen shot you provided. They are extremely helpful. Did your node filter return a list of nodes before you ran the job, and were they only Windows hosts? Can you also run the job in debug mode and show the Ansible command line please?