Rundeck 通过插件与 Ansible 集成

Rundeck integration with Ansible through plugin

我无法配置 rundeck 与 ansible 的集成,我使用的是 rundeck-ansible 插件,但我无法从 google 变得简单和有用 information/help。 我在同一台服务器上安装了 ansible 和 rundeck。 我已经使用了那个插件 https://github.com/Batix/rundeck-ansible-plugin 但无法配置它。任何人都可以分享 link 一步一步的指导。任何帮助将不胜感激。

请记住,Ansible plugin 与 Rundeck Community 和 Enterprise 开箱即用,两种解决方案必须共存于同一个 server/host 才能正常工作。所以,基本上,您需要遵循以下步骤:

1- 配置 Ansible model source. For that click on "Project Settings", click on "Edit Nodes..." and then click on the "Add new Node Source +" green button. Take a look. Choose "Ansible Resource Model Source" and define 你的 Ansible 清单文件路径(通常在 /etc/ansible/hosts)和 Ansible 配置路径(通常在 /etc/ansible/ansible.cfg)。在“SSH 连接”部分,您将提供 SSH 用户和身份验证方法来访问您的清单主机(您可以使用私钥路径访问您的清单,例如 .pem 文件访问远程 aws ec2 Linux 个节点),然后向下滚动并单击“保存”绿色按钮。

现在,如果您单击左侧面板上的“节点”link,you can see 您的 Ansible 清单中定义的节点。此外,您可以添加另一个模型源来使用您的剧本。

2- 现在您必须配置 Ansible Ad-Hoc 默认节点执行器以在“命令”部分中分派命令(或在作业中使用默认的“命令”节点步骤)。转到“项目设置”>“编辑配置”并单击“默认节点执行器”选项卡,在左侧列表中将“SSH”更改为“Ansible Ad-Hoc 节点执行器”,定义一个有效的 shell 路径“可执行文件”部分,在“Ansible 配置文件路径”文本框中添加 ansible.cfg 完整路径,转到“SSH 连接”部分和 select 您访问库存的方法,常见情况是到 select“privateKey”并提供私钥路径,如 .pem 文件以访问远程 aws ec2 Linux 节点。

3- Now you can run any playbooks/inline-playbooks 在你的 ansible 节点上。

我将作业定义示例(带有基本的内联脚本剧本)分配给 Inventory 主机:

- 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 剧本(以及使用内联 Ansible 剧本)的更多信息。