57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
---
|
|
- name: add gpg key
|
|
ansible.builtin.apt_key:
|
|
url: https://packages.gitlab.com/runner/gitlab-runner/gpgkey
|
|
tags: gitlab-runner
|
|
|
|
- name: add repository
|
|
ansible.builtin.apt_repository:
|
|
repo: '{{ gitlab_runner_repository }}'
|
|
tags: gitlab-runner
|
|
|
|
- name: install package
|
|
ansible.builtin.package:
|
|
name:
|
|
- gitlab-runner
|
|
environment:
|
|
GITLAB_RUNNER_DISABLE_SKEL: 'true'
|
|
tags: gitlab-runner
|
|
|
|
- name: create system directory
|
|
ansible.builtin.file:
|
|
path: /etc/systemd/system/gitlab-runner.service.d
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
state: directory
|
|
tags: gitlab-runner
|
|
|
|
- name: add environment variables
|
|
ansible.builtin.template:
|
|
src: environment.conf.j2
|
|
dest: /etc/systemd/system/gitlab-runner.service.d/ansible.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: restart gitlab-runner
|
|
tags: gitlab-runner
|
|
|
|
- name: register runners
|
|
gitlab_runner:
|
|
name: '{{ item.name }}'
|
|
url: '{{ item.url }}'
|
|
token: '{{ item.token }}'
|
|
executor: '{{ item.executor }}'
|
|
options: '{{ item.options|default({}) }}'
|
|
state: '{{ item.state|default("present") }}'
|
|
loop: '{{ gitlab_runner_runners }}'
|
|
loop_control:
|
|
label: '{{ item.name }}'
|
|
tags: gitlab-runner
|
|
|
|
- name: enable and start service
|
|
ansible.builtin.service:
|
|
name: gitlab-runner
|
|
state: started
|
|
enabled: true
|
|
tags: gitlab-runner
|