Custom Playbook
Custom playbook enables you to customize or create your own playbook based on requirements.
Creating Custom Playbook
To create a custom playbook, perform the following:
- Use the following command to establish connection to Pulse host:
cd <PULSE_HOME>/work/<CLUSTER_NAME>/director/playbooks
- Use the following command to access the directory:
mkdir -p test-playbook
- Add a file
in above created directory. Refer the following example of JSON structure:playbook.json
{
"filename": "test-script/playbook.yml",
"version": "0.0.1",
"id": "test-playbook",
"name": "Test Playbook",
"category": ["General"],
"description": "Test Acceldata Action feature",
"variables": [
{
"name": "echo_text",
"data_type": "string",
"description": "The text to echo."
}
]
}
The following table provides description of the parameters:
Parameter | Description |
Filename | Name of the ansible playbook file. Path relative to |
Version | Version of the playbook. Currently unused. |
ID | A unique playbook identifier. |
Name | Name of the playbook. The name that is displayed Actions page in the UI. |
Category | Category of the playbook. |
Description | Describes the function of the playbook. |
Variables | List of variables included in the ansible playbook. Variables required by the user to input from the Actions page in the UI. |
The following table provides description of the variable structure:
Parameters | Description |
Name | Name of the variable. The name should match with the variable identifier in the playbook. |
Data type |
|
Description | Description of the variable used in UI. |
- Add a file
in above created directory. Perform the following steps to authenticate Kerberos:playbook.yml
Note
: Pulse v2.1.0 introduces a task which is required when creating a new playbook. If Kerberos is enabled the user must supply the is_kerberized flag as Kerberos Auth, as well as the Kerberos Principle and the Keytab file path.true
4.1. Copy the keytab file from the source to the destination.
Use the following task to copy the keytab file from source to the destination location.
---
- hosts: all
tasks:
- name: Copy Kerberos Keytab to remote at /tmp
when : is_kerberized is defined and is_kerberized|bool == true
ansible.builtin.copy:
src: "{{ kerberos_keytab }}"
dest: /tmp/kerberos_{{ kerberos_principle }}.keytab
owner: root
group: root
mode: '0600'
The file is copied as read-only and the is defined as owner.root
4.2 Authenticate Kerberos running the kinit command.
The task uses the and kerberos_principal files to do the authentication. Run the following task and ensure to add kerberos_keytab as true to authenticate.is_kerberized
- name: Keberos Auth using kinit
when : is_kerberized is defined and is_kerberized|bool == true
command : kinit -kt /tmp/kerberos_"{{ kerberos_principle }}".keytab "{{ kerberos_principle }}"
register: output_kerberos
- debug: var=output_kerberos.stdout_lines
4.3 Add the task that you want to run. The following YAML task is an example.
name: Test command
command : echo " scan 'hbase:meta', {COLUMNS => ['info:state', 'info:server']} " | hbase shell -n
register: output
- debug: var=output
4.4 Remove the keytab file from the /tmp location.
Run the following task to remove the copied file from the destination.
- name: Remove kerberos keytab file from /tmp
when : is_kerberized is defined and is_kerberized|bool == true
ansible.builtin.file:
path: /tmp/kerberos_{{ kerberos_principle }}.keytab
state: absent
Command to Run the Playbook
ansible-playbook -i <host_ip>, --private-key <ssh_key_path> -u <ssh_host> --extra-vars
"kerberos_keytab=<PATH of the keytab file> kerberos_principle=<kerberos_principle> is_kerberized=<boolean>" playbook.yml
Deploying Custom Playbook
To deploy the playbook you created to the Pulse UI, Perform the following:
- Structure of playbook directory:
test-playbook
└── test_playbook.sh
├── playbook.json
└── playbook.yml
- Run the following command to restart the
container.ad-director
accelo restart ad-director
- Go to Pulse UI and click on the option Create Action to view the newly added playbook.
Limitations
:
- Does not support password-based authentication to execute playbooks
- Option to export and import created playbooks.

Have a suggestion?