I am not able to configure the rundeck integration with ansible, I am using the rundeck-ansible plugin, but I am not getting easy and useful information/help from google. I have installed ansible and rundeck on the same server. I have used that plugin https://github.com/Batix/rundeck-ansible-plugin but not able to configure it. can anyone please share the link which have guide step by step. Any help will be appreciated.
Keep in mind that the Ansible plugin is out of the box with Rundeck Community and Enterprise, both solutions must coexist in the same server/host to work correctly. So, basically, you need to follow these steps:
1- Configure the 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 your Ansible inventory file path (usually at /etc/ansible/hosts
) and Ansible config path (usually at /etc/ansible/ansible.cfg
). In the "SSH connection" section you will provide the SSH user and authentication method to access your inventory hosts (you can use the private key path to access your inventory, like the .pem
file to access to the remote aws ec2 Linux nodes), then scroll down and click on the "Save" green button.
Now if you click on the "Nodes" link on the left panel, you can see the nodes defined in your Ansible inventory. Also, you can add another model source to use your playbooks.
2- Now you must configure the Ansible Ad-Hoc Default Node Executor to dispatch commands in the "Commands" section (or use the default "Command" node step in a job). Go to "Project Settings" > "Edit Configuration" and click on the "Default Node Executor" tab, in the left list change "SSH" by "Ansible Ad-Hoc Node Executor", define a valid shell path in the "Executable" section, add the ansible.cfg
full path in "Ansible config file path" textbox, go to the "SSH Connection" section and select your method to access to your inventory, a common case is to select "privateKey" and provide the private key path, like the .pem
file to access to the remote aws ec2 Linux nodes.
3- Now you can run any playbooks/inline-playbooks over your ansible node.
I leave a job definition example (with a basic inline-script playbook) dispatched to an Inventory host:
- 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
You can watch this video to learn more about run Ansible playbooks (and use inline Ansible playbooks) on Rundeck.