Scripting
Configure and use the OneFuse Scripting module with Red Hat Ansible
2 minute read
To learn more about this OneFuse module, refer to Scripting.
Prerequisites
- Configure OneFuse Manager
- Review an overview on OneFuse Modules with OneFuse Ansible Module
Ansible OneFuse Module name
- Ansible OneFuse Module name for this OneFuse Module is:
scripting
present
Run Provisioning Script(s) configured on the OneFuse Scripting Policy for a resource.
Sample Play
- name: OneFuse Scripting - present
hosts: localhost
gather_facts: false
vars:
policy_name: <REPLACEME_with_OneFusePolicyName>
tasks:
- name: Execute Provisioning Script
onefuse:
module: scripting
state: present
policy_name: '{{ policy_name }}'
template_properties: {}
tracking_id: '{{ tracking_id | default(omit) }}'
delegate_to: localhost
register: output
- name: Output Results
debug:
msg: '{{ output }}'
- name: "Pass Script Outputs to workflow"
set_stats:
data:
onefuse_script: '{{ onefuse_script }}'
Parameter references
The following defines the function of each Scripting specific Task Parameters for onefuse.
| Parameter Name | Required? | Notes |
|---|---|---|
module |
Required | OneFuse Module Name (string). (Refer to Module names for OneFuse modules.) |
state |
Required | present for provision, or the appropriate “update” state for the OneFuse Module. |
policy_name |
Required | OneFuse Module Policy Name (string). |
template_properties |
Optional | Additional properties that are referenced within the Policy. Python dict format. |
tracking_id |
Optional | Tracking ID (string) to link multiple OneFuse Policy Executions and resulting OneFuse Managed Objects together. If none is passed, one gets generated by OneFuse for that specific Policy Execution. |
absent
Run Deprovisioning Script(s), if configured on the OneFuse Scripting Policy, for a resource.
Sample Play
- name: OneFuse Scripting - absent
hosts: '{{ ansible_host }}'
gather_facts: false
tasks:
- name: Run Deprovision Script
onefuse:
module: scripting
state: absent
object_name: '{{ onefuse_script.id | default(omit) }}'
delegate_to: localhost
register: output
- name: Output Results
debug:
msg: '{{ output }}'
Parameter references
The following defines the function of the Task Parameters for onefuse.
| Parameter Name | Required? | Notes |
|---|---|---|
module |
Required | OneFuse Module Name (string). (Refer to Module names for OneFuse modules.) |
state |
Required | absent for deprovision. |
object_name |
Required | OneFuse Managed Object ID (string). |