From c79ca1ff03604dbe1e5106bd2107a96546a59346 Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Sat, 3 Mar 2018 22:38:41 -0800 Subject: [PATCH] Adding an example playbook to the README --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8e18453..ceeaeb0 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 +``` + -- GitLab