|
5 | 5 |
|
6 | 6 | # Ansible
|
7 | 7 |
|
8 |
| -Using Semaphore UI you can run Terraform code. To do this, you need to create a **Terraform Code Template**. |
| 8 | +Using Semaphore UI you can run Ansible playbooks. To do this, you need to create an **Ansible Playbook** Template. |
9 | 9 |
|
10 |
| -1. Go go Task Templates section and click the **New Template** button. |
| 10 | +1. Go go **Task Templates** section, click on **New Template** and then **Ansible Playbook**. |
11 | 11 |
|
12 |
| - |
| 12 | + |
13 | 13 |
|
14 |
| -2. Set up the template and click the **Create** button. |
| 14 | +2. Set up the template. |
15 | 15 |
|
16 |
| - |
| 16 | +The template allows you to specify the following parameters: |
17 | 17 |
|
18 |
| -3. You can now run your Terraform code. |
| 18 | +* Repository |
| 19 | +* Path to playbook file |
| 20 | +* Inventory |
| 21 | +* Variable Groups |
| 22 | +* Vaults |
| 23 | +* and much more |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +An ansible-playbook template can be one of the following types: |
| 28 | + |
| 29 | +* [Task](#task) |
| 30 | +* [Build](#build) |
| 31 | +* [Deploy](#deploy) |
| 32 | + |
| 33 | +### Task |
| 34 | + |
| 35 | +Just runs specified playbooks with specified parameters. |
| 36 | + |
| 37 | +### Build |
| 38 | + |
| 39 | +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. |
| 40 | + |
| 41 | +.png>) |
| 42 | + |
| 43 | +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. |
| 44 | + |
| 45 | +### Deploy |
| 46 | + |
| 47 | +This type of template should be used to deploy artifacts to the destination servers. Each `deploy` template is associated with a `build` template. |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +This allows you to deploy a specific version of the artifact to the servers. |
| 52 | + |
| 53 | +### Schedule |
| 54 | + |
| 55 | +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). |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +#### Run a task when a new commit is added to the repository |
| 60 | + |
| 61 | +You can use cron to periodically check for new commits in the repository and trigger a task upon their arrival. |
| 62 | + |
| 63 | +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. |
| 64 | + |
| 65 | + |
0 commit comments