{"id":15055510,"url":"https://github.com/riemers/ansible-gitlab-runner","last_synced_at":"2026-01-17T07:15:31.563Z","repository":{"id":38867274,"uuid":"65276738","full_name":"riemers/ansible-gitlab-runner","owner":"riemers","description":"Ansible role to install gitlab-runner","archived":false,"fork":false,"pushed_at":"2026-01-16T11:05:43.000Z","size":593,"stargazers_count":388,"open_issues_count":1,"forks_count":297,"subscribers_count":10,"default_branch":"master","last_synced_at":"2026-01-17T00:52:11.485Z","etag":null,"topics":["ansible","gitlab","role","runner"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riemers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-08-09T08:20:06.000Z","updated_at":"2026-01-16T10:38:19.000Z","dependencies_parsed_at":"2023-11-16T07:28:48.251Z","dependency_job_id":"ccfa9bf1-a21a-45c8-aeaf-c2f8e2036897","html_url":"https://github.com/riemers/ansible-gitlab-runner","commit_stats":null,"previous_names":[],"tags_count":123,"template":false,"template_full_name":null,"purl":"pkg:github/riemers/ansible-gitlab-runner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemers%2Fansible-gitlab-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemers%2Fansible-gitlab-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemers%2Fansible-gitlab-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemers%2Fansible-gitlab-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riemers","download_url":"https://codeload.github.com/riemers/ansible-gitlab-runner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riemers%2Fansible-gitlab-runner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28503297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","gitlab","role","runner"],"created_at":"2024-09-24T21:43:32.630Z","updated_at":"2026-01-17T07:15:31.544Z","avatar_url":"https://github.com/riemers.png","language":"Jinja","funding_links":[],"categories":["Jinja"],"sub_categories":[],"readme":"GitLab Runner [![Build Status](https://app.travis-ci.com/riemers/ansible-gitlab-runner.svg?branch=master)](https://travis-ci.org/riemers/ansible-gitlab-runner) [![Ansible Role](https://img.shields.io/badge/role-riemers.gitlab--runner-blue.svg?maxAge=2592000)](https://galaxy.ansible.com/ui/standalone/roles/riemers/gitlab-runner/)\n=============\n\nThis role will install the [official GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner)\n(fork from haroldb) with updates. Needed something simple and working, this did the trick for me. Open for changes though.\n\nRequirements\n------------\n\nThis role requires:\n\n* Ansible 2.13 or higher\n* Installed Ansible Galaxy collections listed in file [requirements.yml](requirements.yml)\n\nRole Variables\n--------------\n\n- `gitlab_runner_package_name` - **As of GitLab 10.x**, the package name `gitlab-ci-multi-runner` has been renamed to `gitlab-runner`. To install a version earlier than 10.x, define the variable `gitlab_runner_package_name: gitlab-ci-multi-runner`.\n- `gitlab_runner_wanted_version` or `gitlab_runner_package_version` - Use these to install a specific version of the GitLab Runner (by default, the latest version is installed). \n  - On macOS and Windows, use `gitlab_runner_wanted_version: 12.4.1` (example).\n  - On Linux, use `gitlab_runner_package_version` instead.\n- `gitlab_runner_concurrent` - Defines the maximum number of jobs that can run concurrently. Defaults to the number of processor cores.\n- `gitlab_runner_registration_token` - The GitLab registration token. If specified, this will register each runner with a GitLab server. **Note**: This token can only be used globally if `gitlab_runner_registration_token_type` is set to the deprecated `registration-token`. Otherwise, you must specify a `token` for each item in `gitlab_runner_runners`, as shown in the example playbook below. This token is deprecated in GitLab version 16.0 and will be removed in version 18.0.\n- `gitlab_runner_registration_token_type` - Specifies the type of registration token to use for GitLab Runner registration:\n  - Set to \"authentication-token\" to register the runner with the `--token` option (following the new workflow: https://docs.gitlab.com/ee/ci/runners/new_creation_workflow.html).\n  - Set to \"registration-token\" to register the runner with the `--registration-token` option. This is deprecated in GitLab 16.0 but remains usable until it is removed in version 18.0.\n  - For GitLab version 16.0 and above, it is recommended to specify a token for each runner in the `gitlab_runner_runners` section and set this variable to \"authentication-token\".\n- `gitlab_runner_coordinator_url` - The GitLab coordinator URL. Defaults to `https://gitlab.com`.\n- `gitlab_runner_sentry_dsn` - Enables tracking of system-level errors to Sentry.\n- `gitlab_runner_listen_address` - Enables the `/metrics` endpoint for Prometheus scraping.\n- `gitlab_runner_runners` - A list of GitLab runners to register and configure. By default, this is set to a single shell executor.\n- `gitlab_runner_skip_package_repo_install` - Skips the installation of the APT or YUM repository (default: false). You should ensure that the necessary packages are available in your repository before running this role.\n- `gitlab_runner_keyring_path` - Path to the GitLab Runner repository GPG keyring file (default: `/etc/apt/keyrings/runner_gitlab-runner-archive-keyring.gpg`).\n  - Set to `/etc/apt/keyrings/runner_gitlab-runner-archive-keyring.gpg` (default) if using APT \u003e 1.1\n  - Set to `/etc/apt/trusted.gpg.d/runner_gitlab-runner.gpg` if using legacy APT \u003c 1.1)\n  - Set to custom path if you expect a different location for the keyring\n- `gitlab_runner_config_update_mode` - Defines how configuration updates are applied:\n  - Set to `by_config_toml` (default) to apply configuration changes directly by updating the `config.toml` file.\n  - Set to `by_registering` if changes should be applied by unregistering and re-registering the runner when configuration changes.\n  - Set to `by_template` if changes for all runners should directly be written in the `config.toml` file. This method is faster than `by_config_toml`. From the original `config.toml` it reads only 3 fields per runner: `id`, `token_obtained_at` and `token_expires_at`.\n  All other content from the file is ignored\n- `gitlab_unregister_runner_executors_which_are_not_longer_configured` - Set to `true` if executors should be unregistered from a runner when they are no longer configured in Ansible. Default: `false`.\n\nSee the [defaults/main.yml](https://github.com/riemers/ansible-gitlab-runner/blob/master/defaults/main.yml) file for a list of all possible options that can be passed to a runner registration command.\n\n### Gitlab Runners cache\nFor each gitlab runner in gitlab_runner_runners you can set cache options. At the moment role support s3, azure and gcs types.\nExample configurration for s3 can be:\n```yaml\ngitlab_runner:\n  cache_type: \"s3\"\n  cache_path: \"cache\"\n  cache_shared: true\n  cache_s3_server_address: \"s3.amazonaws.com\"\n  cache_s3_access_key: \"\u003caccess_key\u003e\"\n  cache_s3_secret_key: \"\u003csecret_key\u003e\"\n  cache_s3_bucket_name: \"\u003cbucket_name\u003e\"\n  cache_s3_bucket_location: \"eu-west-1\"\n  cache_s3_insecure: false\n```\n\n## Autoscale Runner Machine vars for AWS (optional)\n\n- `MachineOptions: []` - Foremost you need to pass an array of dedicated vars in the machine_options to configure your scaling runner:\n\n  + `amazonec2-access-key` and `amazonec2-secret-key` the keys of the dedicated IAM user with permission for EC2\n  + `amazonec2-zone`\n  + `amazonec2-region`\n  + `amazonec2-vpc-id`\n  + `amazonec2-subnet-id`\n  + `amazonec2-use-private-address=true`\n  + `amazonec2-security-group`\n  + `amazonec2-instance-type`\n  + you can also set `amazonec2-tags` to identify you instance more easily via aws-cli or the console.\n\n- `MachineDriver` - which should be set to `amzonec2` when working on AWS\n- `MachineName` - Name of the machine. It **must** contain `%s`, which will be replaced with a unique machine identifier.\n- `IdleCount` - Number of machines, that need to be created and waiting in Idle state.\n- `IdleTime` - Time (in seconds) for machine to be in Idle state before it is removed.\n- `MaxGrowthRate` - The maximum number of machines that can be added to the runner in parallel. Default is 0 (no limit).\n- `MaxBuilds` - Maximum job (build) count before machine is removed.\n- `IdleScaleFactor` - (Experimental) The number of Idle machines as a factor of the number of machines currently in use. Must be in float number format. See the autoscale documentation for more details. Defaults to 0.0.\n- `IdleCountMin` - \tMinimal number of machines that need to be created and waiting in Idle state when the IdleScaleFactor is in use. Default is 1.\n\n### Read Sources\nFor details follow these links:\n\n- [gitlab-docs/runner: advanced configuration: runners.machine section](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersmachine-section)\n- [gitlab-docs/runner: autoscale: supported cloud-providers](https://docs.gitlab.com/runner/configuration/autoscale.html#supported-cloud-providers)\n- [gitlab-docs/runner: autoscale_aws: runners.machine section](https://docs.gitlab.com/runner/configuration/runner_autoscale_aws/#the-runnersmachine-section)\n\nSee the [config for more options](https://github.com/riemers/ansible-gitlab-runner/blob/master/tasks/register-runner.yml)\n\nExample Playbook\n----------------\n```yaml\n- hosts: all\n  become: true\n  vars_files:\n    - vars/main.yml\n  roles:\n    - { role: riemers.gitlab-runner }\n```\n\nInside `vars/main.yml`\n```yaml\ngitlab_runner_coordinator_url: https://gitlab.com\ngitlab_runner_registration_token: '12341234'\ngitlab_runner_runners:\n  - name: 'Example Docker GitLab Runner'\n    # token is an optional override to the global gitlab_runner_registration_token\n    token: 'abcd'\n    # url is an optional override to the global gitlab_runner_coordinator_url\n    url: 'https://my-own-gitlab.mydomain.com'\n    executor: docker\n    docker_image: 'alpine'\n    tags:\n      - node\n      - ruby\n      - mysql\n    docker_volumes:\n      - \"/var/run/docker.sock:/var/run/docker.sock\"\n      - \"/cache\"\n    extra_configs:\n      runners.docker:\n        memory: 512m\n        allowed_images: [\"ruby:*\", \"python:*\", \"php:*\"]\n      runners.docker.sysctls:\n        net.ipv4.ip_forward: \"1\"\n```\n\n## autoscale setup on AWS\nhow `vars/main.yml` would look like, if you setup an autoscaling GitLab-Runner on AWS:\n\n```yaml\ngitlab_runner_registration_token: 'HUzTMgnxk17YV8Rj8ucQ'\ngitlab_runner_coordinator_url: 'https://gitlab.com'\ngitlab_runner_runners:\n  - name: 'Example autoscaling GitLab Runner'\n    state: present\n    # token is an optional override to the global gitlab_runner_registration_token\n    token: 'HUzTMgnxk17YV8Rj8ucQ'\n    executor: 'docker+machine'\n    # Maximum number of jobs to run concurrently on this specific runner.\n    # Defaults to 0, simply means don't limit.\n    concurrent_specific: '0'\n    docker_image: 'alpine'\n    # Indicates whether this runner can pick jobs without tags.\n    run_untagged: true\n    machine_IdleCount: 1\n    machine_IdleTime: 1800\n    machine_MaxBuilds: 10\n    machine_MachineDriver: 'amazonec2'\n    machine_MachineName: 'git-runner-%s'\n    machine_MachineOptions: [\"amazonec2-access-key={{ lookup('env','AWS_IAM_ACCESS_KEY') }}\", \"amazonec2-secret-key={{ lookup('env','AWS_IAM_SECRET_KEY') }}\", \"amazonec2-zone={{ lookup('env','AWS_EC2_ZONE') }}\", \"amazonec2-region={{ lookup('env','AWS_EC2_REGION') }}\", \"amazonec2-vpc-id={{ lookup('env','AWS_VPC_ID') }}\", \"amazonec2-subnet-id={{ lookup('env','AWS_SUBNET_ID') }}\", \"amazonec2-use-private-address=true\", \"amazonec2-tags=gitlab-runner\", \"amazonec2-security-group={{ lookup('env','AWS_EC2_SECURITY_GROUP') }}\", \"amazonec2-instance-type={{ lookup('env','AWS_EC2_INSTANCE_TYPE') }}\"]\n    machine_autoscaling:\n      - Periods: [\"* * 7-18 * * mon-fri *\"]\n        Timezone: \"UTC\"\n        IdleCount: 3\n        IdleTime: 900\n      - Periods: [\"* * * * * sat,sun *\"]\n        Timezone: \"UTC\"\n        IdleCount: 0\n        IdleTime: 300\n```\n\n### NOTE\nfrom https://docs.gitlab.com/runner/executors/docker_machine.html:\n\n\u003eThe **first time** you’re using Docker Machine, it’s best to execute **manually** `docker-machine create...` with your chosen driver and **all options from the MachineOptions** section. This will set up the Docker Machine environment properly and will also be a good validation of the specified options. After this, you *can destroy the machine* with `docker-machine rm [machine_name]` and start the Runner.\n\nExample:\n\n```docker-machine create -d amazonec2 --amazonec2-zone=a --amazonec2-region=us-east-1 --amazonec2-vpc-id=vpc-11111111 --amazonec2-subnet-id=subnet-1111111 --amazonec2-use-private-address=true --amazonec2-tags=gitlab-runner --amazonec2-instance-type=t3.medium test\n\ndocker-machine rm test\n```\n\nRun As A Different User\n-----------------------\nTo run the Gitlab Runner as a different user (rather than the default `gitlab-runner` user), there is a workaround requiring a little\nextra Ansible to be run. See https://github.com/riemers/ansible-gitlab-runner/issues/277 for details.\n\nContributors\n------------\nFeel free to add your name to the readme if you make a PR. A full list of people from the PR's is [here](https://github.com/riemers/ansible-gitlab-runner/pulls?q=is%3Apr+is%3Aclosed)\n\n- Gastrofix for adding Mac Support\n- Matthias Schmieder for adding Windows Support\n- dniwdeus \u0026 rosenstrauch for adding AWS autoscale option\n- oscillate123 for fixing Windows config.toml idempotency\n- [cchaudier](https://github.com/cchaudier) for fixing changing the version of a package which is on the apt hold list\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friemers%2Fansible-gitlab-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friemers%2Fansible-gitlab-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friemers%2Fansible-gitlab-runner/lists"}