Skip to content

Commit fdc38fb

Browse files
authored
Merge pull request #180 from sluetze/runner-network
added possibility to define a network for the containers
2 parents d7c2b5e + d16e300 commit fdc38fb

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ gitlab_runner_windows_service_password: ''
4848
# gitlab_runner_container_install
4949
gitlab_runner_container_install: false
5050

51+
# you can define a network which the container connects to
52+
# this option uses network_mode, thus 'default' will use the first network found in docker network list
53+
gitlab_runner_container_network: default
54+
5155
# default state to restart
5256
gitlab_runner_restart_state: restarted
5357

tasks/Container.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@
7272
- type: bind
7373
source: /var/run/docker.sock
7474
target: /var/run/docker.sock
75+
network_mode: "{{ gitlab_runner_container_network }}"

tasks/register-runner-container.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
target: /etc/gitlab-runner
120120
cleanup: yes
121121
auto_remove: yes
122+
network_mode: "{{ gitlab_runner_container_network }}"
122123
when: (verified_runners.container.Output.find("Verifying runner... is removed") != -1) or
123124
((configured_runners.container.Output.find('\n' + gitlab_runner.name|default(ansible_hostname+'-'+gitlab_runner_index|string)) == -1) and
124125
(gitlab_runner.state|default('present') == 'present'))

0 commit comments

Comments
 (0)