我无法配置 rundeck 与 ansible 的集成,我正在使用 rundeck-ansible 插件,但我没有从 google 获得简单有用的信息/帮助。 我已经在同一台服务器上安装了ansible和rundeck。 我已经使用了该插件https://github.com/Batix/rundeck-ansible-plugin但无法配置它。任何人都可以分享有逐步指导的链接。任何帮助将不胜感激。
请记住,Ansible 插件 与 Rundeck Community 和 Enterprise 一起开箱即用,两种解决方案必须共存于同一服务器/主机中才能正常工作。所以,基本上,您需要遵循以下步骤:
1- 配置 Ansible 模型源。为此,单击“项目设置”,单击“编辑节点...”,然后单击“添加新节点源+”绿色按钮。拍一个。 “Ansible 资源模型源”和 您的 Ansible 库存文件路径(通常位于
/etc/ansible/hosts
)和 Ansible 配置路径(通常位于 /etc/ansible/ansible.cfg
)。在“SSH 连接”部分中,您将提供 SSH 用户和身份验证方法来访问您的清单主机(您可以使用私钥路径来访问您的清单,例如 .pem
文件来访问远程 aws ec2 Linux 节点) ,然后向下滚动并单击“保存”绿色按钮。
现在,如果您单击左侧面板上的“节点”链接,您的 Ansible 清单中定义的节点。此外,您还可以添加另一个模型源来使用您的剧本。
2- 现在,您必须配置 Ansible Ad-Hoc 默认节点执行器以在“命令”部分中调度命令(或在作业中使用默认的“命令”节点步骤)。转到“项目设置”>“编辑配置”并单击“默认节点执行器”选项卡,在左侧列表中将“SSH”更改为“Ansible Ad-Hoc Node Executor”,在“可执行文件”中定义有效的 shell 路径部分,在“Ansible 配置文件路径”文本框中添加
ansible.cfg
完整路径,转到“SSH 连接”部分并选择访问清单的方法,常见的情况是选择“privateKey”并提供私钥路径,例如用于访问远程 aws ec2 Linux 节点的 .pem
文件。
我留下了一个分配给库存主机的作业定义示例(带有基本的内联脚本剧本):
- defaultTab: nodes
description: ''
executionEnabled: true
id: 9cbbdb03-9335-4307-b766-de1f17d81f93
loglevel: INFO
name: Ansible Inline Playboook Example
nodeFilterEditable: false
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: false
rankOrder: ascending
successOnEmptyNodeFilter: false
threadcount: '1'
filter: 'name: 192.168.33.20'
nodesSelectedByDefault: true
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- configuration:
ansible-base-dir-path: /etc/ansible
ansible-become: 'false'
ansible-playbook-inline: |-
---
- hosts: all
user: vagrant
tasks:
- name: uptime
command: 'uptime'
register: output
- debug: var=output.stdout_lines
ansible-ssh-passphrase-option: option.password
ansible-ssh-use-agent: 'false'
nodeStep: true
type: com.batix.rundeck.plugins.AnsiblePlaybookInlineWorkflowNodeStep
keepgoing: false
strategy: node-first
uuid: 9cbbdb03-9335-4307-b766-de1f17d81f93
您可以观看 this 视频,了解有关在 Rundeck 上运行 Ansible playbook(以及使用内联 Ansible playbook)的更多信息。