{"id":18663107,"url":"https://github.com/asapdotid/ansible-role-gitlab_runner","last_synced_at":"2026-04-28T18:07:00.026Z","repository":{"id":187205749,"uuid":"674202411","full_name":"asapdotid/ansible-role-gitlab_runner","owner":"asapdotid","description":"Install and configure gitlab-runner on your system.","archived":false,"fork":false,"pushed_at":"2023-08-13T07:18:42.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T16:43:17.010Z","etag":null,"topics":["ansible","ansible-role","development","gitlab-runner","gitlabrunner","playbook"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asapdotid.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}},"created_at":"2023-08-03T11:26:13.000Z","updated_at":"2023-08-03T11:31:10.000Z","dependencies_parsed_at":"2023-08-09T12:21:29.712Z","dependency_job_id":null,"html_url":"https://github.com/asapdotid/ansible-role-gitlab_runner","commit_stats":null,"previous_names":["asapdotid/ansible-role-gitlab_runner"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fansible-role-gitlab_runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fansible-role-gitlab_runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fansible-role-gitlab_runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asapdotid%2Fansible-role-gitlab_runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asapdotid","download_url":"https://codeload.github.com/asapdotid/ansible-role-gitlab_runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239487306,"owners_count":19646984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","ansible-role","development","gitlab-runner","gitlabrunner","playbook"],"created_at":"2024-11-07T08:15:01.305Z","updated_at":"2025-11-06T07:30:36.528Z","avatar_url":"https://github.com/asapdotid.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \u003cimg src=\"https://user-images.githubusercontent.com/34257858/129839002-15e3f2c7-3f75-46d4-afae-0fd207d7fdde.png\" width=\"100\" height=\"100\"\u003e\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n    Role GitLab Runner\n\u003c/h1\u003e\n\n\u003cp align=\"center\" style=\"font-size: 1.2rem;\"\u003e\n    This ansible role install and configure GitLab Runner packages On AlmaLinux, Debian, RedHat and Rocky Linux.\n\u003c/p\u003e\n\n\u003e GitLab 16.0 and later\n\nThis role will install the [official GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner).\n(Custom and inspire from [riemers](https://github.com/riemers/ansible-gitlab-runner)) with updates. Needed something simple and working, this did the trick for me.\n\n### Runner authentication tokens (also called runner tokens)\n\n\u003e In `GitLab 16.0 and later`, you can use an authentication token to register runners instead of a registration token. _Runner registration tokens have been deprecated_.\n\nTo generate an authentication token, you create a runner in the GitLab UI and use the authentication token instead of the registration token.\n\n| Process                         | Registration command                                                                                      |\n| ------------------------------- | --------------------------------------------------------------------------------------------------------- |\n| Registration token (deprecated) | gitlab-runner register --registration-token `$RUNNER_REGISTRATION_TOKEN` _runner configuration arguments_ |\n| Authentication token            | gitlab-runner register --token `$RUNNER_AUTHENTICATION_TOKEN`                                             |\n\n[Read Doc](https://docs.gitlab.com/ee/security/token_overview.html)\n\n## Requirements\n\nThis role requires Ansible 2.7 or higher.\n\n## Role Variables\n\n| Name                            | Default Value           | Description                                                                       |\n| ------------------------------- | ----------------------- | --------------------------------------------------------------------------------- |\n| `gitlab_runner_setup`           | `install`               | Specify whether you want to install Gitlab Runner `install`/`upgrade`/`uninstall` |\n| `gitlab_runner_version`         | `\"16.1.0\"`              | The version of the GitLab runner to install                                       |\n| `gitlab_runner_coordinator_url` | `\"https://gitlab.com/\"` | The URL to register the runner                                                    |\n| `gitlab_runner_runners`         | `[]`                    | A list of runners to register and configure                                       |\n\nSee the [`defaults/main.yml`](https://github.com/asapdotid/ansible-role-gitlab_runner/blob/master/defaults/main.yml) file listing all possible options which you can be passed to a runner registration command.\n\n### Gitlab Runners cache\n\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\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### Read Sources\n\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\n## Example Playbook\n\n```yaml\n- hosts: all\n  become: true\n  vars_files:\n    - vars/main.yml\n  roles:\n    - { role: asapdotid.gitlab_runner }\n```\n\nInside `vars/main.yml`\n\n```yaml\ngitlab_runner_runners:\n  # Using docker executor\n  - name: Gitlab-Runner Docker\n    state: present\n    token: \"{{ vault_gitlab_runner_docker_token }}\"\n    # url is an optional override to the global gitlab_runner_coordinator_url\n    url: https://gitlab.com\n    executor: docker\n    docker_image: alpine\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:\n          - node:*\n          - alpine:*\n          - asapdotid/node-alpine:*\n          - asapdotid/ansible-alpine:*\n      runners.docker.sysctls:\n        net.ipv4.ip_forward: \"1\"\n    cache_type: s3\n    cache_path: app-cache\n    cache_shared: false\n    cache_s3_server_address: \"{{ __minio_host }}:{{ __minio_port }}\"\n    cache_s3_access_key: \"{{ __minio_root_user }}\"\n    cache_s3_secret_key: \"{{ __minio_root_password }}\"\n    cache_s3_bucket_name: \"{{ __minio_default_bucket }}\"\n    cache_s3_insecure: true\n    # Using shell executor\n  - name: Gitlab-Runner Shell\n    state: present\n    token: \"{{ vault_gitlab_runner_shell_token }}\"\n    # url is an optional override to the global gitlab_runner_coordinator_url\n    url: https://gitlab.com\n    executor: shell\n```\n\n### Autoscale setup on AWS\n\nhow `vars/main.yml` would look like, if you setup an autoscaling GitLab-Runner on AWS:\n\n```yaml\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: \"{{ vault_gitlab_runner_docker_machine_token }}\"\n    executor: \"docker+machine\"\n    docker_image: \"alpine\"\n    # Indicates whether this runner can pick jobs without tags.\n    run_untagged: true\n    extra_configs:\n      runners.machine:\n        IdleCount: 1\n        IdleTime: 1800\n        MaxBuilds: 10\n        MachineDriver: \"amazonec2\"\n        MachineName: \"git-runner-%s\"\n        MachineOptions:\n          [\n            \"amazonec2-access-key={{ lookup('env','AWS_IAM_ACCESS_KEY') }}\",\n            \"amazonec2-secret-key={{ lookup('env','AWS_IAM_SECRET_KEY') }}\",\n            \"amazonec2-zone={{ lookup('env','AWS_EC2_ZONE') }}\",\n            \"amazonec2-region={{ lookup('env','AWS_EC2_REGION') }}\",\n            \"amazonec2-vpc-id={{ lookup('env','AWS_VPC_ID') }}\",\n            \"amazonec2-subnet-id={{ lookup('env','AWS_SUBNET_ID') }}\",\n            \"amazonec2-use-private-address=true\",\n            \"amazonec2-tags=gitlab-runner\",\n            \"amazonec2-security-group={{ lookup('env','AWS_EC2_SECURITY_GROUP') }}\",\n            \"amazonec2-instance-type={{ lookup('env','AWS_EC2_INSTANCE_TYPE') }}\",\n          ]\n```\n\n#### NOTE\n\nfrom https://docs.gitlab.com/runner/executors/docker_machine.html:\n\n\u003e The **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```bash\ndocker-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```\n\nRemove docker machine:\n\n```bash\ndocker-machine rm test\n```\n\n## Dependencies\n\n--\n\n## License\n\nApache License V2\n\n## Author Information\n\n[JogjaScript](https://jogjascript.com)\n\nThis role was created in 2023 by [Asapdotid](https://github.com/asapdotid).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasapdotid%2Fansible-role-gitlab_runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasapdotid%2Fansible-role-gitlab_runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasapdotid%2Fansible-role-gitlab_runner/lists"}