rundeck-plugins / ansible-plugin

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

NPE when executing job with ansible playbook #182

Open vitaly-matuzko opened 6 years ago

vitaly-matuzko commented 6 years ago

Installed rundeck with ansible plugin using docker image batix/rundeck-ansible and followed all steps described here: https://github.com/Batix/rundeck-ansible-plugin/blob/master/docker-container.md.

System details: CentOS Linux release 7.3.1611 (Core) Docker version 1.13.1, build 092cba3 Docker Image batix/rundeck-ansible with "Id": "sha256:259d411966bfeb3a81b8e265fa235ac0bd67d83858b3deebc48832a09943ca0f"

So having this configuration:

inventory.ini

[test-group] my-second-server ansible_host={host} ansible_user={user} ansible_ssh_private_key_file=/data/private_key

example-playbook.yaml

--- - name: An example playbook hosts: all tasks: - name: print the current date and time command: date

Job which consists of ansible playbook above always fails and in logs I see:

Execution failed: {number} in project Test-Project: [Workflow result: , step failures: {1=PluginFailed: null}, status: failed]

Here is more detailed debug log:

-- 16:38:07 |   |   | 1: Workflow step executing: StepExecutionItem{type='com.batix.rundeck.plugins.AnsiblePlaybookWorkflowStep', keepgoingOnSuccess=false, hasFailureHandler=false} 16:38:07 |   |   | Failed executing step plugin [com.batix.rundeck.plugins.AnsiblePlaybookWorkflowStep]: 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.AnsiblePlaybookWorkflowStep.executeStep(AnsiblePlaybookWorkflowStep.java:77) at com.dtolabs.rundeck.core.execution.workflow.steps.StepPluginAdapter.executeWorkflowStep(StepPluginAdapter.java:105) at com.dtolabs.rundeck.core.execution.ExecutionServiceImpl.executeStep(ExecutionServiceImpl.java:97) 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$27(WorkflowEngineOperationsProcessor.java:224) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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) 16:38:07 |   |   | 1: Workflow step finished, result: PluginFailed: null

fabiosakiyama commented 6 years ago

I also have the same problem.

System details: Google Compute Engine instan image CentOS 7 x86_64 built on 20180401 rundeck 2.10.8-1 ansible-rundeck-plugin-2.4.0 ansible 2.5.1

My playbook works fine running ansible-playbook my-playbook.yml.

ltamaster commented 6 years ago

I got the same error:

Failed executing step plugin [com.batix.rundeck.plugins.AnsiblePlaybookWorkflowStep]: 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.AnsiblePlaybookWorkflowStep.executeStep(AnsiblePlaybookWorkflowStep.java:77)
    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)

I think the problem is produced on the new inventory generation feature.

https://github.com/Batix/rundeck-ansible-plugin/blob/master/src/main/java/com/batix/rundeck/core/AnsibleRunnerBuilder.java#L700

I will send a PR for that.

brokenjacobs commented 6 years ago

Looks like the plugin is broken until this is merged

frozenice commented 6 years ago

I managed to get Travis working again and released pull request #188 as 2.4.1!

mcassaniti commented 6 years ago

Can you confirm if this has resolved your issue?