rundeck ansible模块 - 没有匹配的节点

时间:2016-07-11 18:24:27

标签: ansible rundeck

system:centos 6.8 x86_64,ansible-2.1,rundeck-2.6.8 Batix / rundeck-ansible-plugin v1.3.0

rundeck在同一个ansible控制器主机上运行,​​我只想从rundeck界面运行playbooks。

运行得很好,但是当我尝试从rundeck运行playbooks时出现错

执行失败:10:没有匹配的节点:MultiNodeSelector {nodenames = [localhost]}

在节点选择为“本地执行”的作业中,在第二个选项“Dispatch to Nodes”上,列表中没有主机。在ansible playbooks中指定的主机,所以我不要raelly需要将它指定为rundeck,我在这里遗漏了什么? rundeck应该在同一主机上运行playbooks,ansible将部署到远程系统。

谢谢, 尼尔。

1 个答案:

答案 0 :(得分:1)

Rundeck keeps its own internal inventory of the hosts, separate from Ansible. The plugin gives you a Resource Model Source to have Rundeck use your Ansible inventory to scan for nodes and populate the Rundeck inventory. You then configure your Rundeck job against the Rundeck inventory.

The plugin uses the defaults, so if you store your inventory in a different place than /etc/ansible/hosts on the Rundeck system, you will need to pass that as a parameter to the Resource Model Source like so:

Rundeck Ansible Resource Model Source Custom Inventory

Another solution would be to create a Rundeck job that merely acts as a wrapper for calling ansible or ansible-playbook and put that as a workflow step:

cd <your ansible dir>

. env/bin/activate # we use virtualenv
export ANSIBLE_CONFIG=/var/lib/rundeck/.ansible.cfg
ansible-playbook -i inventory -l "$RD_OPTION_LIMIT" $RD_OPTION_ANSIBLE_OPTS playbooks/$RD_OPTION_PLAYBOOK

Something like this wouldn't require the rundeck-ansible-plugin as you can configure the Rundeck job options to suit your Ansible argument needs.