简体   繁体   中英

How to call Ansible through Rundeck using docker container?

I am trying to call Ansible through Rundeck. I have created the dockercompose file like this:

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. But my question is: when I try to run the job from Rundeck web interface I am facing the following issue:

/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?

Default Rundeck Docker image doesn't contain Ansible, you need that Ansible coexists in the same container that Rundeck, you have three options:

1) Create your own container with Rundeck and 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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