ansible-role-gitlab_runner/tasks/main.yml

58 lines
1.4 KiB
YAML
Raw Normal View History

2020-08-09 06:20:33 +00:00
---
- name: add gpg key
2022-04-07 13:15:48 +00:00
ansible.builtin.apt_key:
2020-08-09 06:20:33 +00:00
url: https://packages.gitlab.com/runner/gitlab-runner/gpgkey
tags: gitlab-runner
- name: add repository
2022-04-07 13:15:48 +00:00
ansible.builtin.apt_repository:
2020-08-09 06:20:33 +00:00
repo: '{{ gitlab_runner_repository }}'
tags: gitlab-runner
- name: install package
2022-04-07 13:15:48 +00:00
ansible.builtin.package:
name:
- gitlab-runner
2020-08-09 06:20:33 +00:00
environment:
GITLAB_RUNNER_DISABLE_SKEL: 'true'
tags: gitlab-runner
2022-05-10 08:40:42 +00:00
- 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
2020-08-09 06:20:33 +00:00
- name: register runners
2022-04-07 13:20:10 +00:00
gitlab_runner:
2020-08-09 06:20:33 +00:00
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
2022-04-07 13:15:48 +00:00
ansible.builtin.service:
2020-08-09 06:20:33 +00:00
name: gitlab-runner
state: started
enabled: true
tags: gitlab-runner