diff --git a/roles/gitlab_runner/defaults/main.yml b/roles/gitlab_runner/defaults/main.yml
index 0e7039e..2156fe6 100644
--- a/roles/gitlab_runner/defaults/main.yml
+++ b/roles/gitlab_runner/defaults/main.yml
@@ -18,38 +18,38 @@
# along with this program. If not, see .
# Install location settings
-gitlabrunner_install_location: "/srv/gitlab-runner"
-gitlabrunner_config_location: "{{ gitlabrunner_install_location }}/config"
+gitlab_runner_install_location: "/srv/gitlab-runner"
+gitlab_runner_config_location: "{{ gitlab_runner_install_location }}/config"
# The runner image & tag/version to be used
-gitlabrunner_image: "docker.io/gitlab/gitlab-runner"
+gitlab_runner_image: "docker.io/gitlab/gitlab-runner"
# renovate: depName=docker.io/gitlab/gitlab-runner
-gitlabrunner_image_version: "v16.4.0"
-gitlabrunner_image_variant: "alpine-{{ gitlabrunner_image_version }}"
+gitlab_runner_image_version: "v16.4.0"
+gitlab_runner_image_variant: "alpine-{{ gitlab_runner_image_version }}"
# Extra paths that should be created (eg. to be mounted in the container)
-gitlabrunner_extra_paths: []
+gitlab_runner_extra_paths: []
# Enable or disable selinux handling
-gitlabrunner_selinux_enabled: true
+gitlab_runner_selinux_enabled: true
# Should the docker socket be mounted to the gitlab runner (usually needed for the docker executor)
-gitlabrunner_mount_docker_socket: false
+gitlab_runner_mount_docker_socket: false
# Extra volumes that should be added to the gitlab runner container.
-gitlabrunner_extra_volumes: []
+gitlab_runner_extra_volumes: []
# The maximum overall concurrent running jobs. This is the most upper limit of number of jobs using all defined runners, local and autoscale.
-gitlabrunner_concurrent: 1
+gitlab_runner_concurrent: 1
# The interval in seconds, to check for available jobs. (0 means default value is used.
# See https://docs.gitlab.com/runner/configuration/advanced-configuration.html#how-check_interval-works)
-gitlabrunner_check_interval: 0
+gitlab_runner_check_interval: 0
# This is used to define all the runners, that may be served by this gitlab-runner
# !! YOU WILL NEED TO ADJUST THIS! BELOW IS A FULL EXAMPLE!
-gitlabrunner_runners:
- # The URL of the instance that this runner should be associated with
+gitlab_runner_runners:
+ # The URL of the instance that this runner should be associated with
- gitlab_url: https://gitlab.example.com
# The token that you received when registering the runner (not the register token!!!)
diff --git a/roles/gitlab_runner/tasks/main.yml b/roles/gitlab_runner/tasks/main.yml
index ec4ab0c..39b6890 100644
--- a/roles/gitlab_runner/tasks/main.yml
+++ b/roles/gitlab_runner/tasks/main.yml
@@ -20,47 +20,47 @@
- name: Update default SELinux contexts
community.general.sefcontext:
- target: '{{ item }}(/.*)?'
+ target: "{{ item }}(/.*)?"
setype: "container_file_t"
state: present
with_items:
- - "{{ gitlabrunner_config_location }}"
- - "{{ gitlabrunner_extra_paths }}"
+ - "{{ gitlab_runner_config_location }}"
+ - "{{ gitlab_runner_extra_paths }}"
when:
- - gitlabrunner_selinux_enabled
+ - gitlab_runner_selinux_enabled
become: true
- name: Create install directory
ansible.builtin.file:
path: "{{ item }}"
state: directory
- mode: '0700'
- owner: 'root'
- group: 'root'
+ mode: "0700"
+ owner: "root"
+ group: "root"
with_items:
- - "{{ gitlabrunner_install_location }}"
+ - "{{ gitlab_runner_install_location }}"
become: true
- name: Create config directory
ansible.builtin.file:
path: "{{ item }}"
state: directory
- mode: '0700'
- owner: 'root'
- group: 'root'
+ mode: "0700"
+ owner: "root"
+ group: "root"
setype: "container_file_t"
with_items:
- - "{{ gitlabrunner_config_location }}"
- - "{{ gitlabrunner_extra_paths }}"
+ - "{{ gitlab_runner_config_location }}"
+ - "{{ gitlab_runner_extra_paths }}"
become: true
- name: Deploy docker-compose.yml
ansible.builtin.template:
src: docker-compose.yml
- dest: "{{ gitlabrunner_install_location }}/docker-compose.yml"
- mode: '0600'
- owner: 'root'
- group: 'root'
+ dest: "{{ gitlab_runner_install_location }}/docker-compose.yml"
+ mode: "0600"
+ owner: "root"
+ group: "root"
validate: docker-compose -f %s config -q
tags:
- docker
@@ -69,16 +69,16 @@
- name: Deploy config.toml for gitlab-runner
ansible.builtin.template:
src: config.toml
- dest: "{{ gitlabrunner_config_location }}/config.toml"
- mode: '0600'
- owner: 'root'
- group: 'root'
+ dest: "{{ gitlab_runner_config_location }}/config.toml"
+ mode: "0600"
+ owner: "root"
+ group: "root"
become: true
- name: Compose gitlab-runner
community.docker.docker_compose:
state: present
- project_src: "{{ gitlabrunner_config_location }}"
+ project_src: "{{ gitlab_runner_config_location }}"
pull: true
remove_orphans: true
tags:
diff --git a/roles/gitlab_runner/templates/config.toml b/roles/gitlab_runner/templates/config.toml
index ea47a8e..c8802a9 100644
--- a/roles/gitlab_runner/templates/config.toml
+++ b/roles/gitlab_runner/templates/config.toml
@@ -15,10 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-concurrent = {{ gitlabrunner_concurrent }}
-check_interval = {{ gitlabrunner_check_interval }}
+concurrent = {{ gitlab_runner_concurrent }}
+check_interval = {{ gitlab_runner_check_interval }}
-{% for gitlabrunner in gitlabrunner_runners %}
+{% for gitlabrunner in gitlab_runner_runners %}
[[runners]]
name = "{{ gitlabrunner.name }}"
limit = {{ gitlabrunner.limit | default(1) }}
diff --git a/roles/gitlab_runner/templates/docker-compose.yml b/roles/gitlab_runner/templates/docker-compose.yml
index 06a9735..b9025fc 100644
--- a/roles/gitlab_runner/templates/docker-compose.yml
+++ b/roles/gitlab_runner/templates/docker-compose.yml
@@ -19,15 +19,15 @@
version: '2'
services:
runner:
- image: {{ gitlabrunner_image }}:{{ gitlabrunner_image_variant }}
+ image: {{ gitlab_runner_image }}:{{ gitlab_runner_image_variant }}
mem_limit: 128mb
memswap_limit: 256mb
volumes:
- - "{{ gitlabrunner_config_location }}:/etc/gitlab-runner"
-{% if gitlabrunner_mount_docker_socket %}
+ - "{{ gitlab_runner_config_location }}:/etc/gitlab-runner"
+{% if gitlab_runner_mount_docker_socket %}
- "/var/run/docker.sock:/var/run/docker.sock"
{% endif %}
-{% for item in gitlabrunner_extra_volumes %}
+{% for item in gitlab_runner_extra_volumes %}
- "{{item}}"
{% endfor %}
restart: always