Comments (8)
I quickly hacked something together to make this work. I say hacked as I'm not too deep into your role and I'm unsure if this is the way to go for adding that feature. However, it's looking quite ok for a midnight development session :)
-
Added my services configuration as
docker_services
togitlab_runner_runners
gitlab_runner_runners: - name: "{{ inventory_hostname }}-docker" executor: docker # ... some other config omitted for readability ... docker_services: - name: docker:20.10.12-dind command: ["--insecure-registry=10.0.0.0/24"]
-
Created a template file
templates/config.runners.docker.services.j2
{% for service in gitlab_runner.docker_services %} [[runners.docker.services]] {% for attr in service %} {{ attr }} = {{ service[attr] | to_json }} {% endfor %} {% endfor %}
-
Added the following to
tasks/update-config-runner.yml
# Task named "{{ runn_name_prefix }} Set runner docker network option" comes before #### [[runners.docker.services]] section #### - name: "{{ runn_name_prefix }} Set additional services" blockinfile: dest: "{{ temp_runner_config.path }}" content: "{{ lookup('template', 'config.runners.docker.services.j2') if gitlab_runner.docker_services is defined }}" state: "{{ 'present' if gitlab_runner.docker_services is defined else 'absent' }}" marker: "# {mark} runners.docker.services" insertafter: EOF check_mode: no notify: - restart_gitlab_runner - restart_gitlab_runner_macos #### [runners.custom_build_dir] section ##### comes next
That's it. This looks like so in my GitLab runner configuration and works quite well for my needs.
[[runners]]
name = "runner-docker"
executor = "docker"
# ... some other config omitted for readability ...
[runners.cache]
[runners.docker]
volumes = ["/root/.docker/config.json:/root/.docker/config.json:ro", "/certs/client", "/cache"]
image = "docker:20.10.12"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
# BEGIN runners.docker.services
[[runners.docker.services]]
name = "docker:20.10.12-dind"
command = ["--insecure-registry=10.0.0.1/8"]
# END runners.docker.services
from ansible-gitlab-runner.
If your happy with the code and tested it, no reason not to make a PR for it. I have reverted PR's in the past because of issues but that is the point of the test and its a community effort :)
from ansible-gitlab-runner.
ping @riemers
from ansible-gitlab-runner.
This does sound a lot like one of the open issues, where multiple instances are created where it doesn't work with. I believe it is this one #85 which has no fix for it yet. Would take some time to fix too, which i sadly don't have at this time. (new job/kids etc)
from ansible-gitlab-runner.
@riemers thanks for clarifying this to me 👍 . So I don't need a direct solution for my problem 😏 because I wanted only to clarify that my assumption is correct and I can try to make a pr for this case that others could use this as well.
Thanks for your work on this project it did give me a nice easy smooth start.
from ansible-gitlab-runner.
I've hit the same problem.
A bit of background:
The way I've been setting up the runners so far was to avoid using gitlab-runner register
command entirely, instead doing the process purely in Ansible:
- in case the runner is already registered in coordinator, retrieve its token (here be dragons!) with Runners API
- otherwise: registration entirely via Runners REST API
- templating out the
config.toml
This worked perfectly... until token value was removed from the API entirely. And this is how I stumbled across this excellent role :-)
Back to the problem at hand: I also need to use [[runners.docker.services]]
. Not sure I'd manage the time to add support for this as I need to put something together fast - but in case I do, would it make more sense to add services
as a separate option or under extra_configs
?
Services do need to appear as sub-section of runners.docker
, however the existing logic seems harder to change this way. Not sure how to approach this - as the service entry is >1 line... :)
from ansible-gitlab-runner.
This is a longer problem indeed, hence why help is requested. I don't see myself solving this soon though.
from ansible-gitlab-runner.
Seems this message did not get a lot of love. This does not mean it was not seen but time wise might not have made it to proper attention. This is just the clean up action ;)
from ansible-gitlab-runner.
Related Issues (20)
- "The conditional check ''Executor' in json_item' failed HOT 4
- Support of gitlab 15.6+ runners registration way. HOT 13
- "No package matching 'gitlab-runner' is available" HOT 14
- Removed from galaxy HOT 7
- Support for AlmaLinux HOT 3
- Support for (pre,post)_*_script in gitlab-runner config HOT 2
- Set additional services is failing due to missing variable HOT 8
- Invalid config.toml for azure and gcp cache HOT 3
- How to set custom_build_dir_enabled as variable HOT 1
- Error when upgrading from gitlab-runner version 15.0.0 to 16.6.0 HOT 2
- Default branch name HOT 5
- Debian Unhold: Failed to find package from ansible-core >=2.16 HOT 1
- Support for docker tmpfs options HOT 2
- Galaxy role renamed back from ansible-gitlab-runner to gitlab-runner HOT 10
- Reactivating Tests: Topic "systemd and docker" HOT 2
- Causes failures when included by ansible-lint HOT 1
- Can't find package `gitlab-runner` HOT 3
- tls_ca_file not included in container registration HOT 1
- Runtime owner and group for container setup HOT 1
- Deploy multiple executors to single VM
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-gitlab-runner.