File tree Expand file tree Collapse file tree 6 files changed +38
-1
lines changed
Expand file tree Collapse file tree 6 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 5151 {% if gitlab_runner.docker_network_mode is defined %}
5252 --docker-network-mode '{{ gitlab_runner.docker_network_mode }}'
5353 {% endif %}
54+ {% if gitlab_runner.docker_hostname is defined %}
55+ --docker-hostname '{{ gitlab_runner.docker_hostname }}'
56+ {% endif %}
5457 --ssh-user '{{ gitlab_runner.ssh_user | default("") }}'
5558 --ssh-host '{{ gitlab_runner.ssh_host | default("") }}'
5659 --ssh-port '{{ gitlab_runner.ssh_port | default("") }}'
Original file line number Diff line number Diff line change 4242 {% if gitlab_runner.docker_network_mode is defined %}
4343 --docker-network-mode '{{ gitlab_runner.docker_network_mode }}'
4444 {% endif %}
45+ {% if gitlab_runner.docker_hostname is defined %}
46+ --docker-hostname '{{ gitlab_runner.docker_hostname }}'
47+ {% endif %}
4548 {% if gitlab_runner.ssh_user is defined %}
4649 --ssh-user '{{ gitlab_runner.ssh_user }}'
4750 {% endif %}
Original file line number Diff line number Diff line change 8787 {% for device in gitlab_runner.docker_devices | default([]) %}
8888 --docker-devices "{{ device }}"
8989 {% endfor %}
90- {% if gitlab_runner.docker_network_mode is defined %}
90+ {% if gitlab_runner.docker_network_mode | default(false) %}
9191 --docker-network-mode '{{ gitlab_runner.docker_network_mode }}'
9292 {% endif %}
93+ {% if gitlab_runner.docker_hostname is defined %}
94+ --docker-hostname '{{ gitlab_runner.docker_hostname }}'
95+ {% endif %}
9396 --ssh-user '{{ gitlab_runner.ssh_user | default("") }}'
9497 --ssh-host '{{ gitlab_runner.ssh_host | default("") }}'
9598 --ssh-port '{{ gitlab_runner.ssh_port | default("") }}'
Original file line number Diff line number Diff line change 191191 check_mode : false
192192 notify : restart_gitlab_runner_windows
193193
194+ - name : " Set docker hostname option {{ runn_name_prefix }}"
195+ community.windows.win_lineinfile :
196+ dest : " {{ temp_runner_config.path }}"
197+ regexp : ^\s*hostname =.*
198+ line : ' hostname = {{ gitlab_runner.docker_hostname | default("") | to_json }}'
199+ state : " {{ 'present' if gitlab_runner.docker_hostname is defined else 'absent' }}"
200+ insertafter : ^\s*executor =
201+ backrefs : false
202+ check_mode : false
203+ notify : restart_gitlab_runner_windows
204+
194205- name : " Set cache type option {{ runn_name_prefix }}"
195206 community.windows.win_lineinfile :
196207 dest : " {{ temp_runner_config.path }}"
Original file line number Diff line number Diff line change 383383 - restart_gitlab_runner
384384 - restart_gitlab_runner_macos
385385
386+ - name : " Set runner docker hostname {{ runn_name_prefix }}"
387+ ansible.builtin.lineinfile :
388+ dest : " {{ temp_runner_config.path }}"
389+ regexp : ^\s*hostname =
390+ line : ' hostname = {{ gitlab_runner.docker_hostname | default("") | to_json }}'
391+ state : " {{ 'present' if gitlab_runner.docker_hostname is defined else 'absent' }}"
392+ insertafter : ^\s*\[runners\.docker\]
393+ backrefs : false
394+ check_mode : false
395+ no_log : " {{ gitlab_runner_no_log_secrets | default(omit) }}"
396+ notify :
397+ - restart_gitlab_runner
398+ - restart_gitlab_runner_macos
399+
386400- name : " Set tls-cert-file option {{ runn_name_prefix }}"
387401 ansible.builtin.lineinfile :
388402 dest : " {{ temp_runner_config.path }}"
Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ sentry_dsn = "{{ gitlab_runner_sentry_dsn }}"
115115{% if gitlab_runner .docker_network_mode is defined %}
116116 network_mode = {{ gitlab_runner.docker_network_mode | default("bridge") | tojson }}
117117{% endif %}
118+ {% if gitlab_runner .docker_hostname is defined %}
119+ hostname = {{ gitlab_runner.docker_hostname | default("") | tojson }}
120+ {% endif %}
118121{% if gitlab_runner .docker_disable_entrypoint_overwrite is defined %}
119122 disable_entrypoint_overwrite = {{ gitlab_runner.docker_disable_entrypoint_overwrite | default(false) | tojson }}
120123{% endif %}
You can’t perform that action at this time.
0 commit comments