main.yml 1.44 KB
Newer Older
1
2
3
---

- name: install dependencies
4
  pacman: name=docker,python-docker,python-gitlab,gitlab-runner state=latest update_cache=yes
5
  notify: restart gitlab-runner
6
7

- name: start docker
8
  systemd: name=docker enabled=yes state=started daemon_reload=yes
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

- name: make docker0 interface trusted
  firewalld: interface=docker0 zone=trusted permanent=true state=enabled immediate=yes
  when: configure_firewall
  tags:
    - firewall

- name: register gitlab-runner
  command: >
    gitlab-runner register
    --non-interactive
    --url=https://gitlab.archlinux.org/
    --docker-image=alpine:latest
    --tag-list=docker
    --registration-token="{{ vault_gitlab_runner_registration_token }}"
    --executor=docker
    --description="{{ inventory_hostname }}"
26
    --run-untagged=false
27
28
29
30
31
32
33
34
35
    --docker-tlsverify=true
    --locked=false
    --access-level=not_protected
  args:
    creates: /etc/gitlab-runner/config.toml

- name: increase concurrency
  lineinfile:
    path: /etc/gitlab-runner/config.toml
36
37
    owner: root
    group: root
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
38
    mode: 0600
39
40
    regexp: '^concurrent = .*'
    line: concurrent = 100
41
  notify: restart gitlab-runner
42

43
44
45
46
47
48
49
- name: enable prometheus exporter
  lineinfile:
    path: /etc/gitlab-runner/config.toml
    insertbefore: '^concurrent'
    line: listen_address = ":{{ gitlab_runner_exporter_port }}"
  notify: restart gitlab-runner

50
- name: enable and start gitlab runner service
51
  systemd: name=gitlab-runner state=started enabled=yes daemon_reload=yes