main.yml 1.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---

- name: install dependencies
  pacman: name=docker,python-docker,python-gitlab,gitlab-runner state=present

- name: start docker
  service: name=docker enabled=yes state=started

- name: open firewall holes
  firewalld: port={{ item }} permanent=true state=enabled immediate=yes
  when: configure_firewall
  with_items:
    - "8093/tcp"
  tags:
    - firewall

- 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 }}"
    --run-untagged=true
    --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
    regexp: '^concurrent = .*'
    line: concurrent = 100
  notify: restart gitlab runner

- name: enable and start gitlab runner service
  service: name=gitlab-runner state=started enabled=yes