|
1 | 1 | <h1 align="center">GitHub Actions self-hosted Runner Ansible role</h1>
|
2 | 2 |
|
3 |
| -Work In Progress. |
| 3 | +An Ansible role that installs and configures GitHub Actions self-hosted Runners |
| 4 | +inside one or multiple hosts, you can re-use it for many different URLs |
| 5 | +(repositories or organizations) inside the same host in order to re-use it as |
| 6 | +much as possible. |
4 | 7 |
|
5 |
| -All-in-all the features of this Ansible role are implemented just not |
6 |
| -documented and well-presented yet. Ansible Galaxy repository import and |
7 |
| -documentation about the variables are on its way. |
| 8 | +Main goals of this role: |
8 | 9 |
|
9 |
| -To-dos: |
| 10 | +- _avoid waste_: re-use the same host to provide a build environment for |
| 11 | + multiple repositories or organizations; |
| 12 | +- _idempotence_: executing the role many times won't make anything break, steps |
| 13 | + have checks that validate whether or not they should be executed; |
10 | 14 |
|
11 |
| -- [ ] Improve this README with variables + instructions; |
12 |
| -- [ ] Import to Ansible Galaxy; |
13 |
| -- [ ] Add CI using molecule; |
14 |
| -- [ ] Integrate GitHub actions to run the CI; |
15 |
| -- [ ] Add Code lint (YAML lint + ansible lint) on CI; |
16 |
| -- [ ] Include documentation |
| 15 | +## Variables |
| 16 | + |
| 17 | +For an exhaustive list of variables check the [defaults](defaults/main.yaml) |
| 18 | +file. Ideally, all values will have commentaries describing what are their |
| 19 | +purposes and by the default value you can tell the type. |
| 20 | + |
| 21 | +### Required variables |
| 22 | + |
| 23 | +Following values are required since there is no way to register the self-hosted |
| 24 | +Runner without them |
| 25 | + |
| 26 | +| Name | Description | |
| 27 | +| ---------------------- | -------------------------------------------------- | |
| 28 | +| gh_runner_config_url | GitHub Repository or Organization URL | |
| 29 | +| gh_runner_config_token | GitHub Registration token to authenticate the host | |
| 30 | + |
| 31 | +## Example Playbook |
| 32 | + |
| 33 | +Simplest use case: Single repository configuration on one host. |
| 34 | + |
| 35 | +```yaml |
| 36 | +- hosts: foo |
| 37 | + roles: |
| 38 | + - role: macunha1.github_actions_runner |
| 39 | + vars: |
| 40 | + gh_runner_config_labels: |
| 41 | + - linux |
| 42 | + - self-hosted |
| 43 | + |
| 44 | + gh_runner_config_url: https://github.com/macunha1/ansible-github-actions-runner |
| 45 | + gh_runner_config_token: AC5TNLJP9SBAFNEKKLLBLF264J8XO |
| 46 | +``` |
| 47 | +
|
| 48 | +Complex use case to which this role was created for |
| 49 | +
|
| 50 | +```yaml |
| 51 | +- hosts: foo |
| 52 | + roles: |
| 53 | + - role: macunha1.github_actions_runner |
| 54 | + vars: |
| 55 | + gh_runner_config_labels: |
| 56 | + - linux |
| 57 | + - self-hosted |
| 58 | + |
| 59 | + gh_runner_config_url: https://github.com/macunha1/ansible-github-actions-runner |
| 60 | + gh_runner_config_token: AC5TNLJP9SBAFNEKKLLBLF264J8XO |
| 61 | + |
| 62 | + - role: macunha1.github_actions_runner |
| 63 | + vars: |
| 64 | + gh_runner_config_url: https://github.com/macunha1/another-repository |
| 65 | + gh_runner_config_token: AC5CQV3IJRR2OAFGEFCPJ0WJPJQXO |
| 66 | + |
| 67 | + - role: macunha1.github_actions_runner |
| 68 | + vars: |
| 69 | + gh_runner_config_url: https://github.com/macunha-acme-corp |
| 70 | + gh_runner_config_token: ACYWUR9MHGR9U58C34W9ZK00UNBF |
| 71 | +``` |
| 72 | +
|
| 73 | +Note that despite using the same host, each one of these GitHub Actions Runner |
| 74 | +configuration will have its own path and credentials. Therefore, they can live |
| 75 | +well in harmony without killing each other. |
| 76 | +
|
| 77 | +## Contribute |
| 78 | +
|
| 79 | +[](http://makeapullrequest.com) |
| 80 | +
|
| 81 | +Feel free to fill [an issue](https://github.com/macunha1/ansible-github-actions-runner/issues) |
| 82 | +containing feature request(s), or (even better) to send me a Pull request, I |
| 83 | +would be happy to collaborate with you. |
| 84 | +
|
| 85 | +If this role didn't work for you, or if you found some bug during the execution, |
| 86 | +let me know. |
0 commit comments