add docker network

This commit is contained in:
Ludovic Cartier 2023-09-29 18:19:49 +02:00
parent c9a0df80c3
commit a1a8c62be7
2 changed files with 11 additions and 6 deletions

View File

@ -9,7 +9,12 @@
- include_tasks: base.yml - include_tasks: base.yml
tags: ['docker_gitlab'] tags: ['docker_gitlab']
- name: 'gitlab-runner | create docker volumes' - name: gitlab-runner | create docker network
docker_network:
name: 'gitlab-runner'
tags: ['docker_gitlab-runner']
- name: gitlab-runner | create docker volumes
docker_volume: docker_volume:
name: '{{ item }}' name: '{{ item }}'
with_items: with_items:
@ -19,7 +24,7 @@
- gitlab-runner__etc_gitlab-runner - gitlab-runner__etc_gitlab-runner
tags: ['docker_gitlab-runner'] tags: ['docker_gitlab-runner']
- name: 'gitlab-runner | register to gitlab' - name: gitlab-runner | register to gitlab
uri: uri:
url: 'https://{{ gitlab_domain }}/api/v4/runners' url: 'https://{{ gitlab_domain }}/api/v4/runners'
method: POST method: POST
@ -33,7 +38,7 @@
- 'gitlab_runner_register_token is defined' - 'gitlab_runner_register_token is defined'
tags: ['docker_gitlab-runner'] tags: ['docker_gitlab-runner']
- name: 'gitlab-runner | configure config.toml' - name: gitlab-runner | configure config.toml
copy: copy:
dest: '/var/lib/docker/volumes/gitlab-runner__etc_gitlab-runner/_data/config.toml' dest: '/var/lib/docker/volumes/gitlab-runner__etc_gitlab-runner/_data/config.toml'
mode: '0600' mode: '0600'
@ -65,7 +70,7 @@
- 'register_gitlab_runner_register.json.token is defined' - 'register_gitlab_runner_register.json.token is defined'
tags: ['docker_gitlab-runner'] tags: ['docker_gitlab-runner']
- name: 'gitab-runner | configure cron garbage in dind' - name: gitab-runner | configure cron garbage in dind
cron: cron:
name: "gitlab_runner_garbage" name: "gitlab_runner_garbage"
minute: "50" minute: "50"
@ -73,7 +78,7 @@
job: "/usr/bin/docker exec docker docker system prune -f; /usr/bin/docker exec docker docker volume prune -f 2>&1 |logger -t gitlab-runner" job: "/usr/bin/docker exec docker docker system prune -f; /usr/bin/docker exec docker docker volume prune -f 2>&1 |logger -t gitlab-runner"
tags: ['docker_gitlab-runner'] tags: ['docker_gitlab-runner']
- name: 'gitab-runner | purge dind cache' - name: gitab-runner | purge dind cache
cron: cron:
name: "purge_dind_ci_cache" name: "purge_dind_ci_cache"
minute: "30" minute: "30"

View File

@ -37,7 +37,7 @@ services:
tag: docker_gitlab-runner tag: docker_gitlab-runner
docker: docker:
image: {{ gitlab_runner_dind_version | default("latest") }} image: docker:{{ gitlab_runner_dind_version | default("latest") }}
container_name: docker container_name: docker
restart: unless-stopped restart: unless-stopped
privileged: yes privileged: yes