我正试图通过Rundeck致电Ansible。我已经创建了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
使用此文件,我可以创建2个服务,一个用于Rundeck,另一个用于Ansible。但是我的问题是:当我尝试从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]
如何使用docker容器通过Rundeck调用Ansible?
答案 0 :(得分:1)
默认Rundeck Docker映像不包含Ansible,您需要将Ansible与Rundeck共存于同一容器中,您有以下三种选择:
1)使用Rundeck和Ansible创建自己的容器。 2)如果需要,可以使用此图像,效果很好:https://hub.docker.com/r/batix/rundeck-ansible/ 3)https://stackoverflow.com/a/47462089/10426011(我认为更复杂)