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
playbook.jsonin above created directory. Refer the following example of JSON structure:
{ "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 src folder. |
| Version | Version of the playbook.
|
| 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.
|
| Data type | string or number or boolean |
| Description | Description of the variable used in UI. |
- Add a file
playbook.ymlin above created directory. Perform the following steps to authenticate Kerberos:
Pulse v2.1.0 introduces a task Kerberos Auth which is required when creating a new playbook. If Kerberos is enabled the user must supply the is_kerberized flag as true, as well as the Kerberos Principle and the Keytab file path.
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.
---hostsall tasksnameCopy 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 ownerroot grouproot mode'0600'owner is defined as root.
4.2 Authenticate Kerberos running the kinit command.
The task uses the kerberos_principal and kerberos_keytab files to do the authentication. Run the following task and ensure to add is_kerberized as true to authenticate.
nameKeberos Auth using kinit when is_kerberized is defined and is_kerberized|bool == true command kinit -kt /tmp/kerberos_"{{ kerberos_principle }}".keytab "{{ kerberos_principle }}" registeroutput_kerberos debugvar=output_kerberos.stdout_lines4.3 Add the task that you want to run. The following YAML task is an example.
nameTest command command echo " scan 'hbase:meta', {COLUMNS => ['info:state', 'info:server']} " | hbase shell -n registeroutputdebugvar=output4.4 Remove the keytab file from the /tmp location.
Run the following task to remove the copied file from the destination.
nameRemove kerberos keytab file from /tmp when is_kerberized is defined and is_kerberized|bool == true ansible.builtin.file path/tmp/kerberos_ kerberos_principle .keytab stateabsentCommand 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.ymlDeploying 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
ad-directorcontainer.
accelo restart ad-director- Go to Pulse UI and click on the option Create Action to view the newly added playbook.
- Does not support password-based authentication to execute playbooks
- Option to export and import created playbooks.