antmelekhin.gitlab_runner
GitLab Runner
This is an Ansible role for installing GitLab Runner.
Update to 2.x
The previous version (1.x) had a task called Pin Gitlab Runner APT repository that created a config file for Debian Stretch only. I removed this task because it caused issues with selecting package versions in the Install Gitlab Runner package task, and the role no longer supports Debian Stretch.
To use this role without issues, you should either delete the pinning file manually or add a specific task in your Ansible playbook.
- name: 'Install GitLab Runner'
hosts: all
pre_tasks:
- name: 'Remove GitLab Runner APT pinning file'
ansible.builtin.file:
path: '/etc/apt/preferences.d/99-gitlab-runner'
state: absent
become: true
roles:
- role: antmelekhin.gitlab_runner
Requirements
- Ansible version must be 2.12 or higher.
- The
pywinrmlibrary is needed to connect Ansible to Windows hosts via WinRM. - Supported operating systems:
- Amazon Linux
- 2
- 2023
- Debian
- 10
- 11
- 12
- Fedora
- 39
- 40
- RHEL
- 7
- 8
- 9
- Ubuntu
- 18.04
- 20.04
- 22.04
- Windows
- all versions
- Amazon Linux
Role Variables
You can find all the changeable variables in the defaults/main.yml file. For descriptions of available variables, check the meta/argument_specs.yml file. Information on preset variables can be found in the vars/main.yml file.
Dependencies
There are no dependencies.
Example Playbook
To install GitLab Runner:
---
- name: 'Install GitLab Runner'
hosts: all
roles:
- role: antmelekhin.gitlab_runner
To install GitLab Runner version 16.9.1:
---
- name: 'Install GitLab Runner v16.9.1'
hosts: all
roles:
- role: antmelekhin.gitlab_runner
gitlab_runner_package_version: '16.9.1-1'
To install GitLab Runner and set up the shell executor:
---
- name: 'Install GitLab Runner'
hosts: all
roles:
- role: antmelekhin.gitlab_runner
post_tasks:
- name: 'Register GitLab Runner'
ansible.builtin.copy:
content: |
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "{{ ansible_fqdn }}"
url = "https://gitlab.com"
token = "xxxxxxxxxxxx"
executor = "shell"
dest: '/etc/gitlab-runner/config.toml'
owner: 'root'
group: 'root'
mode: 0600
License
MIT
Author Information
Melekhin Anton.
