diff --git a/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml b/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml new file mode 100644 index 00000000..7187adbd --- /dev/null +++ b/scaffolder-templates/ansible-playbook/skeleton/${{values.playbookName}}.yaml @@ -0,0 +1,2 @@ +${{values.playbook}} + diff --git a/scaffolder-templates/ansible-playbook/template.yaml b/scaffolder-templates/ansible-playbook/template.yaml new file mode 100644 index 00000000..e1fd0b3f --- /dev/null +++ b/scaffolder-templates/ansible-playbook/template.yaml @@ -0,0 +1,98 @@ +apiVersion: scaffolder.backstage.io/v1beta3 +kind: Template +metadata: + name: ansible-playbook + title: Ansible Playbook + description: Upload an Ansible Playbook to Git + tags: + - recommended + - aap +spec: + owner: janus-authors + system: janus-idp + type: service + parameters: + - title: Provide information about the GitHub location + required: + - githubOrg + - repoName + - owner + - system + properties: + githubOrg: + title: GitHub Organization + type: string + owner: + title: Owner + type: string + description: Owner of the component + repoName: + title: Repository Name + type: string + system: + title: System + type: string + ui:field: EntityPicker + ui:options: + catalogFilter: + kind: + - System + - title: Ansible Playbook definition + required: + - playbook + - playbookName + - description + properties: + playbookName: + title: Playbook Name + type: string + description: Provide a name for the Ansible Playbook + playbook: + title: Playbook + type: string + description: Ansible Playbook definition + ui:widget: textarea + ui:options: + rows: 15 + description: + title: Description + type: string + description: Description of the Ansible Playbook + steps: + - id: template + name: Generating the source code component + action: fetch:template + input: + url: ./skeleton + targetPath: playbooks/ + values: + component_id: ${{ parameters.playbookName }} + name: ${{ parameters.playbookName }} + playbook: ${{ parameters.playbook }} + playbookName: ${{ parameters.playbookName }} + + - id: publish + name: Publishing to Source Code Repository + action: publish:github:pull-request + input: + allowedHosts: ['github.com'] + title: ${{ parameters.playbookName }} + description: ${{ parameters.description }} + repoUrl: github.com?owner=${{ parameters.githubOrg }}&repo=${{ parameters.repoName }} + branchName: ${{ parameters.playbookName }} + + - id: register + name: Registering the Catalog Info Component + action: catalog:register + input: + repoContentsUrl: ${{ steps.publish.output.repoUrl }} + catalogInfoPath: /catalog-info.yaml + + output: + links: + - title: Source Code Repository + url: ${{ steps.publish.output.repoUrl }} + - title: Open the Catalog Info Component + icon: catalog + entityRef: ${{ steps.register.output.entityRef }} + diff --git a/showcase-templates.yaml b/showcase-templates.yaml index 7bd91408..3434e31b 100644 --- a/showcase-templates.yaml +++ b/showcase-templates.yaml @@ -15,3 +15,5 @@ spec: - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/argocd-template/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-job/template.yaml - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-job-template/template.yaml + - https://github.com/janus-idp/software-templates/blob/main/scaffolder-templates/ansible-playbook/template.yaml +