README.md 2.75 KB
Newer Older
Erick Hitter's avatar
Erick Hitter committed
1
GitLab Runner [![pipeline status](https://git.ethitter.com/ansible/gitlab-runner/badges/master/pipeline.svg)](https://git.ethitter.com/ansible/gitlab-runner/commits/master)
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
###### `gitlab_runner_package_name`

17 18
**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`.

19 20
###### `gitlab_runner_concurrent`

21
The maximum number of global jobs to run concurrently.
Harold Barker's avatar
Harold Barker committed
22 23
Defaults to the number of processor cores.

24 25
###### `gitlab_runner_registration_token`

Harold Barker's avatar
Harold Barker committed
26 27
The GitLab registration token. If this is specified, a runner will be registered to a GitLab server.

28 29
###### `gitlab_runner_coordinator_url`

Harold Barker's avatar
Harold Barker committed
30
The GitLab coordinator URL.
Harold Barker's avatar
Harold Barker committed
31
Defaults to `https://gitlab.com/ci`.
Harold Barker's avatar
Harold Barker committed
32

33 34
###### `gitlab_runner_description_base`
Base description of the runner.
Harold Barker's avatar
Harold Barker committed
35 36
Defaults to the hostname.

37 38
###### `gitlab_runner_executor`

Harold Barker's avatar
Harold Barker committed
39
The executor used by the runner.
Harold Barker's avatar
Harold Barker committed
40
Defaults to `shell`.
Harold Barker's avatar
Harold Barker committed
41

42 43
###### `gitlab_runner_concurrent_specific`

44 45 46
The maximum number of jobs to run concurrently on this specific runner.
Defaults to 0, simply means don't limit.

47 48
###### `gitlab_runner_docker_image`

49 50
The default Docker image to use. Required when executor is `docker`.

51 52 53
###### `gitlab_runner_tags`

Default tags assigned to the runner,
Harold Barker's avatar
Harold Barker committed
54
Defaults to an empty list.
Harold Barker's avatar
Harold Barker committed
55

56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
###### `gitlab_runners`

Dict of runners

```yml
gitlab_runners:
  - {
      description: '{{ gitlab_runner_description_base }}',
      tags: [],
      locked: false,
      token: ''
  }
```

###### `gitlab_runner_cache_type`
Variables to set `s3` as a shared cache server. If set it requires variables listed below:
* `gitlab_runner_cache_s3_server_address`
* `gitlab_runner_cache_s3_access_key`
* `gitlab_runner_cache_s3_secret_key`
* `gitlab_runner_cache_s3_bucket_name`
* `gitlab_runner_cache_s3_insecure`
* `gitlab_runner_cache_cache_shared`
Petr Shilo's avatar
Petr Shilo committed
78

79 80
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
81 82
Example Playbook
----------------
Harold Barker's avatar
Harold Barker committed
83 84 85 86 87 88
```yaml
- hosts: all
  remote_user: root
  vars_files:
    - vars/main.yml
  roles:
89
    - { role: riemers.gitlab-runner }
Harold Barker's avatar
Harold Barker committed
90 91 92 93 94 95 96 97 98 99
```

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