diff --git a/group_vars/ci-runners.yml.example b/group_vars/ci-runners.yml.example
index 438e6ea8dd2b9a026399da53ed3a38ed8ebbf024..79433197631faabcbcb3de04fe857f1457e58a52 100644
--- a/group_vars/ci-runners.yml.example
+++ b/group_vars/ci-runners.yml.example
@@ -1,7 +1,6 @@
runner:
gitlab_url: 'https://gitlab.geant.org/'
+ git_project_name: 'nat/gap'
access_token: xxx
registration_token: xxx
- runner_tags:
- - gap
- - nat
+ executor: shell
diff --git a/inventory.yml b/inventory.yml
index 164ce38b3197e628451a17668d0276a28294258a..2b6b69057e2056991256dde39df6c63d68654e9f 100644
--- a/inventory.yml
+++ b/inventory.yml
@@ -1,5 +1,4 @@
ci-runners:
hosts:
- test-nat-ci01:
- ansible_host:
- test-nat-ci01
+ nat-runner-01:
+ ansible_host: nat-runner-01
diff --git a/roles/gitlab-runner/tasks/main.yml b/roles/gitlab-runner/tasks/main.yml
index 097aa00f7718b7e26836d489d0d87e3a663436f5..997fbf9650f1b9d1f6d925e340614214c554ceb6 100644
--- a/roles/gitlab-runner/tasks/main.yml
+++ b/roles/gitlab-runner/tasks/main.yml
@@ -18,17 +18,30 @@
ansible.builtin.pip:
name: python-gitlab
-- name: Register runner
- no_log: true
+- name: Request runner token
community.general.gitlab_runner:
api_url: '{{ runner.gitlab_url }}'
api_token: '{{ runner.access_token }}'
registration_token: '{{ runner.registration_token }}'
description: '{{ inventory_hostname_short }}'
- project: 'nat/gap'
+ project: '{{ runner.git_project_name }}'
state: present
- tag_list: '{{ runner.runner_tags + [inventory_hostname_short] }}'
+ tag_list: '{{ runner.executor }}-executor'
run_untagged: false
locked: true
access_level_on_creation: true
access_level: 'not_protected'
+ no_log: true
+ register: gitlab_authentication_response
+
+- name: Register GitLab
+ ansible.builtin.command:
+ argv:
+ - gitlab-runner
+ - register
+ - '--url={{ runner.gitlab_url }}'
+ - '--token={{ gitlab_authentication_response.runner.token }}'
+ - '--executor={{ runner.executor }}'
+ - '--non-interactive'
+ become: true
+ no_log: true