Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty config after deploy #359

Open
Heyzi opened this issue Jan 8, 2025 · 3 comments
Open

Empty config after deploy #359

Heyzi opened this issue Jan 8, 2025 · 3 comments

Comments

@Heyzi
Copy link

Heyzi commented Jan 8, 2025

Can't get a working gitlab runner configuration, the final result is always empty. How can you figure out what's missing?
ansible and python:

ansible [core 2.15.13]
  config file = /builds/fu8xHyzy/0/devcloud-developer-service-rus/ide_team/devops/ansible-main/projects/gitlab-runner-installer/inventory/remote/ansible.cfg
  configured module search path = ['/home/ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/lib64/python3.9/site-packages/ansible
  ansible collection location = /home/ansible/ansible_collections
  executable location = /home/ansible/bin/ansible
  python version = 3.9.21 (main, Dec  5 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/home/ansible/bin/python3)
  jinja version = 3.1.5
  libyaml = True

my vars:

---
gitlab_runner_concurrent: 1
gitlab_runner_coordinator_url: "myurl"
gitlab_runner_registration_token: "mytoken"
gitlab_runner_registration_token_type: "registration-token"

gitlab_runner_sentry_dsn: ""

# GitLab TLS CA file
tls_ca_file: ""

gitlab_unregister_runner_executors_which_are_not_longer_configured: true

# default values for gitlab in container
gitlab_runner_container_install: true
gitlab_runner_container_image: gitlab-runner
gitlab_runner_container_tag: v17.7.0
gitlab_runner_container_name: gitlab-runner
gitlab_runner_container_mount_path: "/etc/gitlab-runner"
gitlab_runner_container_restart_policy: unless-stopped
gitlab_runner_container_latest_update: false
gitlab_runner_container_network: default

gitlab_runner_log_format: json
force_accept_gitlab_server_self_signed: true
gitlab_runner_show_config_diff: false
gitlab_runner_runners:
  - name: "Example Docker GitLab Runner"
    state: present
    executor: docker
    output_limit: 4096
    concurrent_specific: "1"
    docker_image: "dind:latest"
    tags:
      - test
    docker_volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/cache"
    docker_privileged: false
    docker_network_mode: bridge
    env_vars: []
    docker_services:
      - name: docker:20.10.12-dind
        command: ["--insecure-registry=10.0.0.0/24"]
    builds_dir: "/builds_dir"
    cache_dir: "/cache"
    feature_flags:
      - FF_TIMESTAMPS: true
      - FF_USE_FASTZIP: true
      - FF_LOG_IMAGES_CONFIGURED_FOR_JOB: true

but in the end, my configuration looks like this:

root@testserver:~# cat /etc/gitlab-runner/config.toml
log_level = "info"
log_format = "json"
check_interval = 0
  session_timeout = 1800
@guenhter
Copy link
Collaborator

Hi, it would be helpful to have the output of the Ansible run to see what steps were executed and ignored.

@Heyzi
Copy link
Author

Heyzi commented Jan 17, 2025

Hi, it would be helpful to have the output of the Ansible run to see what steps were executed and ignored.


2025-01-17T19:31:01.744441Z 01O PLAY [test-server] *************************************************
2025-01-17T19:31:01.777824Z 01O 
2025-01-17T19:31:01.777825Z 01O TASK [Gathering Facts] *********************************************************
2025-01-17T19:31:03.354372Z 01O ok: [test-server]
2025-01-17T19:31:03.370921Z 01O 
2025-01-17T19:31:03.370926Z 01O TASK [riemers.gitlab-runner : Load platform-specific variables] ****************
2025-01-17T19:31:03.388733Z 01O ok: [test-server]
2025-01-17T19:31:03.394816Z 01O 
2025-01-17T19:31:03.394821Z 01O TASK [riemers.gitlab-runner : Validate GitLab Runner configurations] ***********
2025-01-17T19:31:03.428073Z 01O included: /home/ansible/roles/riemers.gitlab-runner/tasks/validate-runner-config.yml for test-server => (item=demo)
2025-01-17T19:31:03.448116Z 01O 
2025-01-17T19:31:03.448121Z 01O TASK [riemers.gitlab-runner : Check for deprecated settings: demo] *************
2025-01-17T19:31:03.469579Z 01O ok: [test-server] => (item=pre_clone_script)
2025-01-17T19:31:03.476416Z 01O 
2025-01-17T19:31:03.476421Z 01O TASK [riemers.gitlab-runner : Install Gitlab Runner (Container)] ***************
2025-01-17T19:31:03.510579Z 01O included: /home/ansible/roles/riemers.gitlab-runner/tasks/main-container.yml for test-server
2025-01-17T19:31:03.517773Z 01O 
2025-01-17T19:31:03.517777Z 01O TASK [riemers.gitlab-runner : (Container) Pull Image from Registry] ************
2025-01-17T19:31:04.292380Z 01O ok: [test-server]
2025-01-17T19:31:04.355210Z 01O 
2025-01-17T19:31:04.355230Z 01O TASK [riemers.gitlab-runner : (Container) Define Container volume Path] ********
2025-01-17T19:31:04.358730Z 01O ok: [test-server]
2025-01-17T19:31:04.365032Z 01O 
2025-01-17T19:31:04.365034Z 01O TASK [riemers.gitlab-runner : (Container) Delete runners which were removed in GitLab] ***
2025-01-17T19:31:05.373842Z 01O ok: [test-server]
2025-01-17T19:31:05.380047Z 01O 
2025-01-17T19:31:05.380050Z 01O TASK [riemers.gitlab-runner : List configured runners as json] *****************
2025-01-17T19:31:06.131113Z 01O ok: [test-server]
2025-01-17T19:31:06.137565Z 01O 
2025-01-17T19:31:06.137567Z 01O TASK [riemers.gitlab-runner : Initialze runner list] ***************************
2025-01-17T19:31:06.148853Z 01O ok: [test-server]
2025-01-17T19:31:06.154801Z 01O 
2025-01-17T19:31:06.154803Z 01O TASK [riemers.gitlab-runner : Create list of configured runners] ***************
2025-01-17T19:31:06.171506Z 01O skipping: [test-server] => (item={'arch': 'amd64', 'level': 'info', 'msg': 'Runtime platform', 'os': 'linux', 'pid': 6, 'revision': '3153ccc6', 'time': '2025-01-17T19:31:05Z', 'version': '17.7.0'}) 
2025-01-17T19:31:06.171890Z 01O skipping: [test-server] => (item={'ConfigFile': '/etc/gitlab-runner/config.toml', 'level': 'info', 'msg': 'Listing configured runners', 'time': '2025-01-17T19:31:05Z'}) 
2025-01-17T19:31:06.172785Z 01O skipping: [test-server]
2025-01-17T19:31:06.178878Z 01O 
2025-01-17T19:31:06.178880Z 01O TASK [riemers.gitlab-runner : Print configured runners] ************************
2025-01-17T19:31:06.191569Z 01O ok: [test-server] => {
2025-01-17T19:31:06.191572Z 01O     "registered_gitlab_runner_names": []
2025-01-17T19:31:06.191573Z 01O }
2025-01-17T19:31:06.197209Z 01O 
2025-01-17T19:31:06.197210Z 01O TASK [riemers.gitlab-runner : (Container) Register GitLab Runner] **************
2025-01-17T19:31:06.231641Z 01O included: /home/ansible/roles/riemers.gitlab-runner/tasks/register-runner-container.yml for test-server => (item={'name': 'demo', 'state': 'present', 'executor': 'shell', 'output_limit': 4096, 'concurrent_specific': '0', 'docker_image': '', 'tags': ['test'], 'run_untagged': False, 'protected': False, 'docker_privileged': False, 'locked': 'false', 'docker_network_mode': 'bridge', 'env_vars': [], 'feature_flags': [{'FF_TIMESTAMPS': True}, {'FF_USE_FASTZIP': True}, {'FF_LOG_IMAGES_CONFIGURED_FOR_JOB': True}]})
2025-01-17T19:31:06.245485Z 01O 
2025-01-17T19:31:06.245487Z 01O TASK [riemers.gitlab-runner : Construct the runner command without secrets] ****
2025-01-17T19:31:06.283871Z 01O ok: [test-server]
2025-01-17T19:31:06.289914Z 01O 
2025-01-17T19:31:06.289916Z 01O TASK [riemers.gitlab-runner : Check if the configuration has changed since the last run] ***
2025-01-17T19:31:06.298606Z 01O skipping: [test-server]
2025-01-17T19:31:06.304421Z 01O 
2025-01-17T19:31:06.304422Z 01O TASK [riemers.gitlab-runner : (Container) Unregister runner] *******************
2025-01-17T19:31:06.313100Z 01O skipping: [test-server]
2025-01-17T19:31:06.318983Z 01O 
2025-01-17T19:31:06.318987Z 01O TASK [riemers.gitlab-runner : (Windows) Unregister runner] *********************
2025-01-17T19:31:06.327618Z 01O skipping: [test-server]
2025-01-17T19:31:06.333681Z 01O 
2025-01-17T19:31:06.333682Z 01O TASK [riemers.gitlab-runner : Unregister runner] *******************************
2025-01-17T19:31:06.341870Z 01O skipping: [test-server]
2025-01-17T19:31:06.347853Z 01O 
2025-01-17T19:31:06.347855Z 01O TASK [riemers.gitlab-runner : List configured runners as json] *****************
2025-01-17T19:31:07.154398Z 01O ok: [test-server]
2025-01-17T19:31:07.160890Z 01O 
2025-01-17T19:31:07.160897Z 01O TASK [riemers.gitlab-runner : Initialze runner list] ***************************
2025-01-17T19:31:07.172473Z 01O ok: [test-server]
2025-01-17T19:31:07.178638Z 01O 
2025-01-17T19:31:07.178643Z 01O TASK [riemers.gitlab-runner : Create list of configured runners] ***************
2025-01-17T19:31:07.195531Z 01O skipping: [test-server] => (item={'arch': 'amd64', 'level': 'info', 'msg': 'Runtime platform', 'os': 'linux', 'pid': 6, 'revision': '3153ccc6', 'time': '2025-01-17T19:31:06Z', 'version': '17.7.0'}) 
2025-01-17T19:31:07.195834Z 01O skipping: [test-server] => (item={'ConfigFile': '/etc/gitlab-runner/config.toml', 'level': 'info', 'msg': 'Listing configured runners', 'time': '2025-01-17T19:31:06Z'}) 
2025-01-17T19:31:07.196249Z 01O skipping: [test-server]
2025-01-17T19:31:07.202209Z 01O 
2025-01-17T19:31:07.202210Z 01O TASK [riemers.gitlab-runner : Print configured runners] ************************
2025-01-17T19:31:07.214459Z 01O ok: [test-server] => {
2025-01-17T19:31:07.214462Z 01O     "registered_gitlab_runner_names": []
2025-01-17T19:31:07.214463Z 01O }
2025-01-17T19:31:07.220166Z 01O 
2025-01-17T19:31:07.220167Z 01O TASK [riemers.gitlab-runner : Register runner to GitLab] ***********************
2025-01-17T19:31:07.853482Z 01O changed: [test-server]
2025-01-17T19:31:07.859392Z 01O 
2025-01-17T19:31:07.859394Z 01O TASK [riemers.gitlab-runner : Unregister runners which are not longer configured] ***
2025-01-17T19:31:07.868829Z 01O skipping: [test-server]
2025-01-17T19:31:07.874921Z 01O 
2025-01-17T19:31:07.874922Z 01O TASK [riemers.gitlab-runner : Create .gitlab-runner dir] ***********************
2025-01-17T19:31:08.128773Z 01O changed: [test-server]
2025-01-17T19:31:08.134763Z 01O 
2025-01-17T19:31:08.134765Z 01O TASK [riemers.gitlab-runner : Ensure config.toml exists] ***********************
2025-01-17T19:31:08.352816Z 01O changed: [test-server]
2025-01-17T19:31:08.358837Z 01O 
2025-01-17T19:31:08.358838Z 01O TASK [riemers.gitlab-runner : Set concurrent option] ***************************
2025-01-17T19:31:08.680802Z 01O ok: [test-server]
2025-01-17T19:31:08.686903Z 01O 
2025-01-17T19:31:08.686905Z 01O TASK [riemers.gitlab-runner : Set check_interval option] ***********************
2025-01-17T19:31:08.902841Z 01O changed: [test-server]
2025-01-17T19:31:08.908799Z 01O 
2025-01-17T19:31:08.908800Z 01O TASK [riemers.gitlab-runner : Add listen_address to config] ********************
2025-01-17T19:31:08.922232Z 01O skipping: [test-server]
2025-01-17T19:31:08.928114Z 01O 
2025-01-17T19:31:08.928116Z 01O TASK [riemers.gitlab-runner : Add log_format to config] ************************
2025-01-17T19:31:09.147180Z 01O changed: [test-server]
2025-01-17T19:31:09.153037Z 01O 
2025-01-17T19:31:09.153038Z 01O TASK [riemers.gitlab-runner : Add log_level to config] *************************
2025-01-17T19:31:09.169557Z 01O skipping: [test-server]
2025-01-17T19:31:09.175425Z 01O 
2025-01-17T19:31:09.175427Z 01O TASK [riemers.gitlab-runner : Add sentry dsn to config] ************************
2025-01-17T19:31:09.187943Z 01O skipping: [test-server]
2025-01-17T19:31:09.193794Z 01O 
2025-01-17T19:31:09.193796Z 01O TASK [riemers.gitlab-runner : Add session server listen_address to config] *****
2025-01-17T19:31:09.411479Z 01O ok: [test-server]
2025-01-17T19:31:09.416937Z 01O 
2025-01-17T19:31:09.416939Z 01O TASK [riemers.gitlab-runner : Add session server advertise_address to config] ***
2025-01-17T19:31:09.639223Z 01O ok: [test-server]
2025-01-17T19:31:09.645293Z 01O 
2025-01-17T19:31:09.645295Z 01O TASK [riemers.gitlab-runner : Add session server session_timeout to config] ****
2025-01-17T19:31:09.864155Z 01O changed: [test-server]
2025-01-17T19:31:09.870072Z 01O 
2025-01-17T19:31:09.870073Z 01O TASK [riemers.gitlab-runner : (Container) Configure GitLab Runner] *************
2025-01-17T19:31:09.889519Z 01O included: /home/ansible/roles/riemers.gitlab-runner/tasks/config-runners-container.yml for test-server
2025-01-17T19:31:09.908380Z 01O 
2025-01-17T19:31:09.908383Z 01O TASK [riemers.gitlab-runner : Get existing config.toml] ************************
2025-01-17T19:31:10.194420Z 01O ok: [test-server]
2025-01-17T19:31:10.200415Z 01O 
2025-01-17T19:31:10.200418Z 01O TASK [riemers.gitlab-runner : Get pre-existing runner configs] *****************
2025-01-17T19:31:10.214137Z 01O ok: [test-server]
2025-01-17T19:31:10.220087Z 01O 
2025-01-17T19:31:10.220091Z 01O TASK [riemers.gitlab-runner : Create temporary directory] **********************
2025-01-17T19:31:10.504059Z 01O ok: [test-server]
2025-01-17T19:31:10.510084Z 01O 
2025-01-17T19:31:10.510122Z 01O TASK [riemers.gitlab-runner : Write config section for each runner] ************
2025-01-17T19:31:10.529491Z 01O included: /home/ansible/roles/riemers.gitlab-runner/tasks/config-runner-container.yml for test-server => (item=log_format = "json"
2025-01-17T19:31:10.529495Z 01O check_interval = 0
2025-01-17T19:31:10.529496Z 01O   session_timeout = 1800
2025-01-17T19:31:10.529497Z 01O )
2025-01-17T19:31:10.541084Z 01O 
2025-01-17T19:31:10.541087Z 01O TASK [riemers.gitlab-runner : Create temporary file conf[1/1]:] ****************
2025-01-17T19:31:10.750793Z 01O ok: [test-server]
2025-01-17T19:31:10.761228Z 01O 
2025-01-17T19:31:10.761231Z 01O TASK [riemers.gitlab-runner : Isolate runner configuration conf[1/1]:] *********
2025-01-17T19:31:11.358924Z 01O ok: [test-server]
2025-01-17T19:31:11.365107Z 01O 
2025-01-17T19:31:11.365113Z 01O TASK [riemers.gitlab-runner : Update config] ***********************************
2025-01-17T19:31:11.382073Z 01O skipping: [test-server] => (item={'name': 'test', 'state': 'present', 'executor': 'shell', 'output_limit': 4096, 'concurrent_specific': '0', 'docker_image': '', 'tags': ['test'], 'run_untagged': False, 'protected': False, 'docker_privileged': False, 'locked': 'false', 'docker_network_mode': 'bridge', 'env_vars': [], 'feature_flags': [{'FF_TIMESTAMPS': True}, {'FF_USE_FASTZIP': True}, {'FF_LOG_IMAGES_CONFIGURED_FOR_JOB': True}]}) 
2025-01-17T19:31:11.383427Z 01O skipping: [test-server]
2025-01-17T19:31:11.393409Z 01O 
2025-01-17T19:31:11.393411Z 01O TASK [riemers.gitlab-runner : Remove runner config conf[1/1]:] *****************
2025-01-17T19:31:11.410034Z 01O skipping: [test-server] => (item={'name': 'demo', 'state': 'present', 'executor': 'shell', 'output_limit': 4096, 'concurrent_specific': '0', 'docker_image': '', 'tags': ['test'], 'run_untagged': False, 'protected': False, 'docker_privileged': False, 'locked': 'false', 'docker_network_mode': 'bridge', 'env_vars': [], 'feature_flags': [{'FF_TIMESTAMPS': True}, {'FF_USE_FASTZIP': True}, {'FF_LOG_IMAGES_CONFIGURED_FOR_JOB': True}]}) 
2025-01-17T19:31:11.411333Z 01O skipping: [test-server]
2025-01-17T19:31:11.417418Z 01O 
2025-01-17T19:31:11.417420Z 01O TASK [riemers.gitlab-runner : Assemble new config.toml] ************************
2025-01-17T19:31:11.727838Z 01O ok: [test-server]
2025-01-17T19:31:11.733840Z 01O 
2025-01-17T19:31:11.733846Z 01O TASK [riemers.gitlab-runner : (Container) Start the container] *****************
2025-01-17T19:31:12.363637Z 01O changed: [test-server]
2025-01-17T19:31:12.369901Z 01O 
2025-01-17T19:31:12.369907Z 01O TASK [riemers.gitlab-runner : Install GitLab Runner (Unix)] ********************
2025-01-17T19:31:12.379535Z 01O skipping: [test-server]
2025-01-17T19:31:12.385773Z 01O 
2025-01-17T19:31:12.385776Z 01O TASK [riemers.gitlab-runner : Install GitLab Runner (Windows)] *****************
2025-01-17T19:31:12.395163Z 01O skipping: [test-server]
2025-01-17T19:31:12.416833Z 01O 
2025-01-17T19:31:12.416834Z 01O RUNNING HANDLER [riemers.gitlab-runner : Restart_gitlab_runner] ****************
2025-01-17T19:31:12.426049Z 01O skipping: [test-server]
2025-01-17T19:31:12.432021Z 01O 
2025-01-17T19:31:12.432024Z 01O RUNNING HANDLER [riemers.gitlab-runner : Restart_gitlab_runner_macos] **********
2025-01-17T19:31:12.440831Z 01O skipping: [test-server]
2025-01-17T19:31:12.452122Z 01O 
2025-01-17T19:31:12.452124Z 01O PLAY RECAP *********************************************************************
2025-01-17T19:31:12.452161Z 01O test-server    : ok=34   changed=7    unreachable=0    failed=0    skipped=16   rescued=0    ignored=0   

@Heyzi
Copy link
Author

Heyzi commented Jan 18, 2025

  • verbose play
TASK [riemers.gitlab-runner : Update config] *******************************************************************************************************************************
task path: /home/ansible/roles/riemers.gitlab-runner/tasks/config-runner-container.yml:19
skipping: [test-server] => (item={'name': 'demo', 'state': 'present', 'executor': 'shell', 'output_limit': 4096, 'concurrent_specific': '0', 'docker_image': '', 'tags': ['test'], 'run_untagged': False, 'protected': False, 'docker_privileged': False, 'locked': 'false', 'docker_network_mode': 'bridge', 'env_vars': [], 'feature_flags': [{'FF_TIMESTAMPS': True}, {'FF_USE_FASTZIP': True}, {'FF_LOG_IMAGES_CONFIGURED_FOR_JOB': True}]})  => {
    "ansible_index_var": "gitlab_runner_index",
    "ansible_loop_var": "gitlab_runner",
    "changed": false,
    "false_condition": "('name = \"'+gitlab_runner.name|default(ansible_hostname+'-'+gitlab_runner_index|string)+'\"') in runner_config",
    "gitlab_runner": {
        "concurrent_specific": "0",
        "docker_image": "",
        "docker_network_mode": "bridge",
        "docker_privileged": false,
        "env_vars": [],
        "executor": "shell",
        "feature_flags": [
            {
                "FF_TIMESTAMPS": true
            },
            {
                "FF_USE_FASTZIP": true
            },
            {
                "FF_LOG_IMAGES_CONFIGURED_FOR_JOB": true
            }
        ],
        "locked": "false",
        "name": "demo",
        "output_limit": 4096,
        "protected": false,
        "run_untagged": false,
        "state": "present",
        "tags": [
            "test"
        ]
    },
    "gitlab_runner_index": 0,
    "skip_reason": "Conditional result was False"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants