Skip to content

Commit 886db76

Browse files
authored
Merge pull request #401 from gwarf/update_template
Update template to deploy docker runner configuration set via extra_configs
2 parents 899d0cc + dd75771 commit 886db76

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Role Variables
3333
- `gitlab_runner_config_update_mode` - Defines how configuration updates are applied:
3434
- Set to `by_config_toml` (default) to apply configuration changes directly by updating the `config.toml` file.
3535
- Set to `by_registering` if changes should be applied by unregistering and re-registering the runner when configuration changes.
36-
- Set to `by_template` if changes for all runners should directly be written in the `config.toml` file. The difference with `by_config_toml` is that this method is faster, but does not take into account the existing configuration of the runners.
36+
- Set to `by_template` if changes for all runners should directly be written in the `config.toml` file. The difference with `by_config_toml` is that this method is faster, but does not take into account the existing configuration of the runners. You may also have to provide additional configuration options for each runner, such as `id` and `token_obtained_at`.
3737
- `gitlab_unregister_runner_executors_which_are_not_longer_configured` - Set to `true` if executors should be unregistered from a runner when they are no longer configured in Ansible. Default: `false`.
3838

3939
See the [defaults/main.yml](https://github.com/riemers/ansible-gitlab-runner/blob/master/defaults/main.yml) file for a list of all possible options that can be passed to a runner registration command.

templates/config.toml.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,20 @@ sentry_dsn = "{{ gitlab_runner_sentry_dsn }}"
124124
{% if gitlab_runner.docker_security_opt is defined %}
125125
security_opt = {{ gitlab_runner.docker_security_opt | tojson }}
126126
{% endif %}
127+
{% if gitlab_runner.extra_configs %}
128+
{% if 'runners.docker' in gitlab_runner.extra_configs %}
129+
{% for key, value in gitlab_runner.extra_configs['runners.docker'].items() %}
130+
{{ key }} = {{ value | tojson }}
131+
{% endfor %}
132+
{% endif %}
133+
{#### [[runners.docker.sysctls]] section ####}
134+
{% if 'runners.docker.sysctls' in gitlab_runner.extra_configs %}
135+
[runners.docker.sysctls]
136+
{% for key, value in gitlab_runner.extra_configs['runners.docker.sysctls'].items() %}
137+
{{ key }} = {{ value | tojson }}
138+
{% endfor %}
139+
{% endif %}
140+
{% endif %}
127141
{#### [[runners.docker.services]] section ####}
128142
{% if gitlab_runner.docker_services is defined %}
129143
{% for service in gitlab_runner.docker_services %}

0 commit comments

Comments
 (0)