diff --git a/README.md b/README.md index 8e184533a4ad76a413639b61fde53622a454ffa9..ceeaeb002700c0f6375296b9017388566856f5d3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ GitLab Runner ========= -This role installs the [`gitlab-runner`][gitlab-runner] agent and registers runners. +This role installs the [`gitlab-runner`][gitlab-runner] agent and registers +runners. Requirements ------------ -This role required Ansible 2.0 or higher. +This role requires Ansible 2.0 or higher. Role Variables -------------- @@ -19,7 +20,8 @@ Role Variables ### Runner Agent Variables -These variables are used to configure the `gitlab-runner` agent, and thus affect all runners registered with this agent. +These variables are used to configure the `gitlab-runner` agent, and thus affect +all runners registered with this agent. | Variable | Default | Purpose | |----------|---------|---------| @@ -34,7 +36,8 @@ These variables are used to configure the `gitlab-runner` agent, and thus affect ### Per-Runner Variables -You can register multiple runners with this role and all these variables below can be configured per runner. +You can register multiple runners with this role and all these variables below +can be configured per runner. | Variable | Default | Purpose | |----------|---------|---------| @@ -45,6 +48,40 @@ You can register multiple runners with this role and all these variables below c | `gitlab_runner_tags` | `[]` | List of tags for which the runner should accept jobs. If not empty, then the runner will only run tagged jobs. | | `gitlab_runner_locked` | `true` | Asserts whether the runner should be locked to the project. | +Example Playbook +---------------- + +This is the basic way to use this role. This will install the GitLab Runner +agent, and register a single runner. + +```yaml +- hosts: servers + roles: + - { role: gitlab-runner, gitlab_runner_url: https://gitlab.com/ci, gitlab_runner_token: <registration-token> } +``` + +It is also possible to register multiple runners by running the role multiple +times. The first run will install the agent and register the first runner, then +each subsequent run will register another runner. + +```yaml +- hosts: servers + tasks: + - include_role: + name: gitlab-runner + vars: + gitlab_runner_url: https://gitlab.com/ci + gitlab_runner_token: <registration-token> + gitlab_runner_description: runner-1 + - include_role: + name: gitlab-runner + vars: + gitlab_runner_install: false + gitlab_runner_url: https://gitlab.com/ci + gitlab_runner_token: <registration-token> + gitlab_runner_description: runner-2 +``` +