Add and launch custom self-service templates
Custom self-service templates are stored as YAML files in repositories in GitHub or Gitlab. When a user launches a software template from self-service automation portal, they must fill in a form with the values needed to run the associated job template in Ansible Automation Platform.
The custom self-service template YAML file must have a token: section that includes a ui:field: key for the authentication token for Ansible Automation Platform. This generates a field for the token in the form that appears when the user launches the template in self-service automation portal. The user enters the token: it is used to authenticate job template execution in Ansible Automation Platform.
The following example shows the token: section in a template. For security reasons, set the value of token.ui:backstage.review.show to false to ensure that the token is not visible to the user.
spec:
...
parameters:
...
properties:
token:
title: Token
type: string
description: Oauth2 token
ui:field: AAPTokenField
ui:widget: hidden
ui:backstage:
review:
show: false
Setting the ui:widget: hidden field hides the Red Hat Ansible Automation Platform token input in the form.
Add a template to self-service automation portal Copy linkLink copied!
You can add a custom self-service template to the Templates view of your self-service automation portal instance. Custom self-service templates are stored in git repositories. self-service automation portal supports GitLab and GitHub Source Control Management (SCM).
Before you begin Copy linkLink copied!
- You have created repositories in your Git SCM for the templates that you want to use.
- In the git repository for your custom templates, ensure that the
metadata.namefield is unique and does not match an existing auto-generated template or another custom self-service template. For example, append*-customto the value of themetadata.namekey.
metadata:
name: provision-database-custom
- You must be logged in to self-service automation portal as an Ansible Automation Platform platform administrator.
About this task Copy linkLink copied!
Names for custom self-service templates must be unique. Custom self-service templates must have a different name to auto-generated job templates and also to other custom self-service templates.
Procedure Copy linkLink copied!
- In a browser, navigate to your self-service automation portal instance and sign in with your Ansible Automation Platform credentials.
- Navigate to the Templates Page.
- Click .
- Enter a valid Git SCM URL for the template that you want to add.
- Click to fetch the template.
- After the template has been fetched, review the list of what will be imported and added to the catalog.
- Click .
Results Copy linkLink copied!
After the import is complete, return to the Templates page to view the newly created template. You can now launch your template.
What to do next Copy linkLink copied!
- You must configure RBAC for your imported custom templates to allow users to view and run them. To do this, you must be logged into self-service automation portal as a platform administrator.
For more information, see Setting up RBAC for custom self-service templates.
Launch a template Copy linkLink copied!
This procedure describes how to launch a template from a tile in the Templates view of your self-service automation portal instance.
Before you begin Copy linkLink copied!
- You have configured RBAC in Ansible Automation Platform for templates that are associated with Ansible Automation Platform job templates.