README.md 2.27 KB
Newer Older
Erik-jan Riemers's avatar
Erik-jan Riemers committed
1
GitLab Runner [![Build Status](https://api.travis-ci.org/riemers/ansible-gitlab-runner.svg?branch=master)](https://travis-ci.org/riemers/ansible-gitlab-runner) [![Ansible Role](https://img.shields.io/badge/role-riemers.gitlab--runner-blue.svg?maxAge=2592000)](https://galaxy.ansible.com/riemers/gitlab-runner/)
Harold Barker's avatar
Harold Barker committed
2 3
=============

4
This role will install the [official GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner)
5
(fork from haroldb) with updates. Needed something simple and working, this did the trick for me. Open for changes though.
Harold Barker's avatar
Harold Barker committed
6 7 8 9 10 11 12 13 14

Requirements
------------

This role requires Ansible 2.0 or higher.

Role Variables
--------------

15 16 17
`gitlab_runner_package_name`
**Since Gitlab 10.x** The package name of `gitlab-ci-multi-runner` has been renamed to `gitlab-runner`. In order to install a version >= 10.x you will need to define this variable `gitlab_runner_package_name: gitlab-runner`.

Harold Barker's avatar
Harold Barker committed
18
`gitlab_runner_concurrent`
19
The maximum number of global jobs to run concurrently.
Harold Barker's avatar
Harold Barker committed
20 21
Defaults to the number of processor cores.

Harold Barker's avatar
Harold Barker committed
22 23 24
`gitlab_runner_registration_token`
The GitLab registration token. If this is specified, a runner will be registered to a GitLab server.

Harold Barker's avatar
Harold Barker committed
25
`gitlab_runner_coordinator_url`
Harold Barker's avatar
Harold Barker committed
26
The GitLab coordinator URL.
Harold Barker's avatar
Harold Barker committed
27
Defaults to `https://gitlab.com/ci`.
Harold Barker's avatar
Harold Barker committed
28

Harold Barker's avatar
Harold Barker committed
29
`gitlab_runner_description`
Harold Barker's avatar
Harold Barker committed
30 31 32
The description of the runner.
Defaults to the hostname.

Harold Barker's avatar
Harold Barker committed
33
`gitlab_runner_executor`
Harold Barker's avatar
Harold Barker committed
34
The executor used by the runner.
Harold Barker's avatar
Harold Barker committed
35
Defaults to `shell`.
Harold Barker's avatar
Harold Barker committed
36

37 38 39 40
`gitlab_runner_concurrent_specific`
The maximum number of jobs to run concurrently on this specific runner.
Defaults to 0, simply means don't limit.

41 42 43
`gitlab_runner_docker_image`
The default Docker image to use. Required when executor is `docker`.

Harold Barker's avatar
Harold Barker committed
44
`gitlab_runner_tags`
Harold Barker's avatar
Harold Barker committed
45 46
The tags assigned to the runner,
Defaults to an empty list.
Harold Barker's avatar
Harold Barker committed
47

48 49
See the [config for more options](https://github.com/riemers/ansible-gitlab-runner/blob/master/tasks/register-runner.yml)

Harold Barker's avatar
Harold Barker committed
50 51
Example Playbook
----------------
Harold Barker's avatar
Harold Barker committed
52 53 54 55 56 57
```yaml
- hosts: all
  remote_user: root
  vars_files:
    - vars/main.yml
  roles:
58
    - { role: riemers.gitlab-runner }
Harold Barker's avatar
Harold Barker committed
59 60 61 62 63 64 65 66 67 68
```

Inside `vars/main.yml`
```yaml
gitlab_runner_registration_token: 'HUzTMgnxk17YV8Rj8ucQ'
gitlab_runner_description: 'Example GitLab Runner'
gitlab_runner_tags:
  - node
  - ruby
  - mysql
69 70 71
gitlab_runner_docker_volumes:
  - "/var/run/docker.sock:/var/run/docker.sock"
  - "/cache"
Harold Barker's avatar
Harold Barker committed
72
```