简体   繁体   English

如何使用docker容器通过Rundeck调用Ansible?

[英]How to call Ansible through Rundeck using docker container?

I am trying to call Ansible through Rundeck. 我试图通过Rundeck致电Ansible。 I have created the dockercompose file like this: 我已经创建了dockercompose文件,如下所示:

version: '3.0'
services:
  Rundeck:
    stdin_open: true
    tty: true
    image: 'jordan/rundeck'
    ports:
      - '4440:4440/tcp'
    volumes:
     - /root/ansibledemo:/data

  ansible:
    stdin_open: true
    tty: true
    image: 'ansible/ansible:default'
    volumes:
     - /root/ansibledemo:/data1

With this file I am able to create the 2 services, one is for Rundeck and the other is for Ansible. 使用此文件,我可以创建2个服务,一个用于Rundeck,另一个用于Ansible。 But my question is: when I try to run the job from Rundeck web interface I am facing the following issue: 但是我的问题是:当我尝试从Rundeck Web界面运行作业时,我面临以下问题:

/bin/sh: 1: ansible-playbook: not found
13:10:10            Result: 127
13:10:10            Failed: NonZeroResultCode: Result code was 127
13:10:10            Execution failed: 1 in project demo: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [localhost: NonZeroResultCode: Result code was 127 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:localhost)=BaseDataContext{{exec={exitCode=127}}}, ContextView(node:localhost)=BaseDataContext{{exec={exitCode=127}}}}, base=null)} ]}, Node failures: {localhost=[NonZeroResultCode: Result code was 127 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:localhost)=BaseDataContext{{exec={exitCode=127}}}, ContextView(node:localhost)=BaseDataContext{{exec={exitCode=127}}}}, base=null)} ]}, status: failed]

How to call Ansible through Rundeck using docker container? 如何使用docker容器通过Rundeck调用Ansible?

Default Rundeck Docker image doesn't contain Ansible, you need that Ansible coexists in the same container that Rundeck, you have three options: 默认Rundeck Docker映像不包含Ansible,您需要将Ansible与Rundeck并存于同一容器中,您有以下三种选择:

1) Create your own container with Rundeck and Ansible. 1)使用Rundeck和Ansible创建自己的容器。 2) If you want, use this image, works great: https://hub.docker.com/r/batix/rundeck-ansible/ 3) https://stackoverflow.com/a/47462089/10426011 (more complicated I think) 2)如果需要,请使用此图像,效果很好: https : //hub.docker.com/r/batix/rundeck-ansible/ 3) https://stackoverflow.com/a/47462089/10426011 (更复杂的我认为)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM