Skip to content

Instalacja Gitlab Runner

W tym wpisie pokażę krok po kroku, jak instaluję GitLab Runnera w praktycznym, produkcyjnym scenariuszu. Skupię się na sprawdzonym podejściu, które stosuję na co dzień — bez zbędnej teorii, za to z naciskiem na poprawną konfigurację, bezpieczeństwo i typowe pułapki, na które łatwo trafić przy pierwszym uruchomieniu runnera.

Jeśli korzystasz z GitLaba do automatyzacji procesów CI/CD i chcesz mieć pełną kontrolę nad tym, gdzie i jak wykonywane są joby, ten materiał jest właśnie dla Ciebie.


  1. Definicja hostów

    ---
    all:
      children:
        vault:
        gitlab_runners:
          children:
            nodes:
              hosts:
                gitlab-runner-1002:
                gitlab-runner-1003:
                gitlab-runner-1004:

    host_vars/ct01002/gitlab-runner.yml

    ---
    inv_gitlab_runner_configuration:
      concurrent: 100
      check_interval: 0
      shutdown_timeout: 0
      session_timeout: 3600
      runners:
        - name: "{{ inventory_hostname }}.gitlab"
          url: "https://gitlab.com"
          register_runner:
            id: 53317509
            token: "{{ inv_secret_gitlab_runner_token }}"
            register_gitlab_api_token: "{{ ivn_secret_gitlab_api_token }}"
            description: "GitLab Runner for dev.rachuna"
            tag_list: ["rachuna-dev"]
            runner_type: "group_type"
            group_id: 132728705
            access_level: "not_protected"
          executor: "docker"
          docker:
            tls_verify: false
            image: "registry.gitlab.com/dev.rachuna/artifacts/containers/python:1.0.0"
            privileged: true
            disable_entrypoint_overwrite: false
            oom_kill_disable: false
            disable_cache: false
            volumes:
              - "/cache:/cache"
              - "/var/run/docker.sock:/var/run/docker.sock"
            shm_size: 0
            network_mode: "host"