diff --git a/src/.gitbook/assets/ansible_1.png b/src/.gitbook/assets/ansible_1.png new file mode 100644 index 0000000..c2a93a5 Binary files /dev/null and b/src/.gitbook/assets/ansible_1.png differ diff --git a/src/.gitbook/assets/ansible_2.png b/src/.gitbook/assets/ansible_2.png new file mode 100644 index 0000000..84f8ef5 Binary files /dev/null and b/src/.gitbook/assets/ansible_2.png differ diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 29d6c57..0c77dd1 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -48,7 +48,7 @@ * [Runners 🅿](./user-guide/projects/runners.md) * [Task Templates](./user-guide/task-templates/README.md) * [Ansible](./user-guide/task-templates/ansible.md) - * [Terraform/OpenTofu](./user-guide/task-templates/terraform/README.md) + * [Terraform/OpenTofu](./user-guide/task-templates/terraform.md) * [Workspaces](./user-guide/task-templates/terraform/workspaces.md) * [States 🅿](./user-guide/task-templates/terraform/states.md) * [Shell/Bash scripts](./user-guide/task-templates/bash.md) diff --git a/src/user-guide/task-templates/README.md b/src/user-guide/task-templates/README.md index 8d3c663..5859340 100644 --- a/src/user-guide/task-templates/README.md +++ b/src/user-guide/task-templates/README.md @@ -1,6 +1,6 @@ # Task Templates -Templates define how to run an Ansible Playbook. The template allows you to specify the following parameters: +Templates define how to run Semaphore tasks. Currently the following task types are supported: * Playbook repository * Playbook filename diff --git a/src/user-guide/task-templates/ansible.md b/src/user-guide/task-templates/ansible.md index eee15dd..8a0a395 100644 --- a/src/user-guide/task-templates/ansible.md +++ b/src/user-guide/task-templates/ansible.md @@ -5,14 +5,61 @@ # Ansible -Using Semaphore UI you can run Terraform code. To do this, you need to create a **Terraform Code Template**. +Using Semaphore UI you can run Ansible playbooks. To do this, you need to create an **Ansible Playbook** Template. -1. Go go Task Templates section and click the **New Template** button. +1. Go go **Task Templates** section, click on **New Template** and then **Ansible Playbook**. -![](<../../.gitbook/assets/terraform_1.webp>) +![](<../../.gitbook/assets/ansible_1.png>) -2. Set up the template and click the **Create** button. +2. Set up the template. -![](<../../.gitbook/assets/terraform_2.webp>) +The template allows you to specify the following parameters: -3. You can now run your Terraform code. \ No newline at end of file +* Repository +* Path to playbook file +* Inventory +* Variable Groups +* Vaults +* and much more + +![](<../../.gitbook/assets/ansible_2.png>) + +An ansible-playbook template can be one of the following types: + +* [Task](#task) +* [Build](#build) +* [Deploy](#deploy) + +### Task + +Just runs specified playbooks with specified parameters. + +### Build + +This type of template should be used to create [artifacts](https://en.wikipedia.org/wiki/Artifact\_\(software\_development\)). The start version of the artifact can be specified in a template parameter. Each run increments the artifact version. + +![](<../../.gitbook/assets/template\_new\_build\_ipad (1).png>) + +Semaphore doesn't support artifacts out-of-box, it only provides task versioning. You should implement the artifact creation yourself. Read the article [CI/CD](../../administration-guide/cicd.md) to know how to do this. + +### Deploy + +This type of template should be used to deploy artifacts to the destination servers. Each `deploy` template is associated with a `build` template. + +![](../../.gitbook/assets/template\_new\_deploy\_ipad.png) + +This allows you to deploy a specific version of the artifact to the servers. + +### Schedule + +You can set up task scheduling by specifying a cron schedule in the template settings. Cron expression format you can find in [documentation](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON\_Expression\_Format). + +![](../../.gitbook/assets/template\_schedule.png) + +#### Run a task when a new commit is added to the repository + +You can use cron to periodically check for new commits in the repository and trigger a task upon their arrival. + +For example you have source code of the app in the git repository. You can add it to **Repositories** and trigger the Build task for new commits. + +![](../../.gitbook/assets/template\_schedule\_commit.png) diff --git a/src/user-guide/task-templates/terraform/README.md b/src/user-guide/task-templates/terraform.md similarity index 100% rename from src/user-guide/task-templates/terraform/README.md rename to src/user-guide/task-templates/terraform.md