Skip to content

Latest commit

 

History

History
91 lines (68 loc) · 3.32 KB

README.md

File metadata and controls

91 lines (68 loc) · 3.32 KB

ansible-gitlab-runner

Installs gitlab-runner as docker container managed by systemd.

Supported systems

  • Ubuntu:
    • 24.04 (noble)
    • 22.04 (jammy)
    • 20.04 (focal)
  • Debian
    • 12 (bookworm)
    • 11 (bullseye)

It's possible other systems are working, but they are not tested.

Requirements

  • Docker
  • Systemd

Tasks

  • Create volume paths for docker container
  • Setup systemd unit file
  • Register runner to gitlab if specified
  • Start/Restart gitlab-runner service

Role parameters

Variable Type Mandatory? Default Description
gitlab_runner_image_name text no gitlab/gitlab-runner Docker image name
gitlab_runner_image_version text no alpine-v12.9.0 Docker image version
gitlab_runner_config_volume text yes Path to config volume
gitlab_runner_gitlab_uri url yes Url to gitlab instance (needed for registration)
gitlab_runner_registration_token text yes Registration token (needed for registration, provided by gitlab)
gitlab_runner_refresh_register boolean no False Delete the old registration config and re-register to Gitlab instance
gitlab_runner_disable_register boolean no False Disable registration (for testing purposes)
gitlab_runner_runner_name text no Runner name for multiple instances on one machine
gitlab_runner_description text no 'Docker_Runner' Runner description displayed in your Gitlab instance

Usage

Add to requirements.yml:

- name: install-gitlab-runner
  src: /~https://github.com/borisskert/ansible-gitlab-runner.git
  scm: git

Typical playbook:

    - hosts: servers
    - role: install-gitlab-runner
      gitlab_runner_image_version: alpine-v12.9.0
      gitlab_runner_gitlab_uri: https://my.gitserver.org/
      gitlab_runner_registration_token: mYReGIstR4TI0NtOK3n
      gitlab_runner_runner_name: my-custom-runner-name
      gitlab_runner_description: My runner description
      gitlab_runner_config_volume: /srv/gitlab-runner
      gitlab_runner_disable_register: no
      gitlab_runner_refresh_register: no

Testing

Requirements:

Run within docker

molecule test

Run within Vagrant

 molecule test --scenario-name vagrant --parallel