GithubHelp home page GithubHelp logo

o1da / ansible-role-docker-gitlab_runner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jtyr/ansible-docker_gitlab_runner

0.0 1.0 0.0 4 KB

Ansible role which installs and registers GitLab Runner via Docker.

License: MIT License

ansible-role-docker-gitlab_runner's Introduction

docker_gitlab_runner

Role which installs and registers GitLab Runner via Docker.

The configuration of the role is done in such way that it should not be necessary to change the role for any kind of configuration. All can be done either by changing role parameters or by declaring completely new configuration as a variable. That makes this role absolutely universal. See the examples below for more details.

Please report any issues or send PR.

Examples

---

- name: Default usage
  hosts: all
  vars:
    # GitLab server URL
    docker_gitlab_runner_server_url: https://gitlab.example.com
    # Registration token
    docker_gitlab_runner_reg_token: mytoken
  roles:
    - docker
    - docker_gitlab_runner

- name: Example of how to run multiple runners on one host
  hosts: all
  vars:
    # GitLab server URL
    docker_gitlab_runner_server_url: https://gitlab.example.com
    # Registration token
    docker_gitlab_runner_reg_token: mytoken
  roles:
    - roles: docker_gitlab_runner
      # Make sure each container has different name
      docker_gitlab_runner_dname: gitlab-runner1
    - roles: docker_gitlab_runner
      # Make sure each container has different name
      docker_gitlab_runner_dname: gitlab-runner2

- name: Example of how to customize the registration command
  hosts: all
  vars:
    # GitLab server URL
    docker_gitlab_runner_server_url: https://gitlab.example.com
    # Registration token
    docker_gitlab_runner_reg_token: mytoken
    # Add list of tags to the runner
    docker_gitlab_runner_reg_opts__custom:
      tag-list: tag1,tag2
  roles:
    - docker
    - docker_gitlab_runner

- name: Example of how to use custom CA for the registration
  hosts: all
  vars:
    # Destination where to install the CA on the host
    ssl_cert_ca_file: /etc/ssl/certs/gitlab_ca.crt
    # Content of the CA
    ssl_cert_ca:
    # GitLab server URL
    docker_gitlab_runner_server_url: https://gitlab.example.com
    # Registration token
    docker_gitlab_runner_reg_token: mytoken
    # Add custom volume to mount into the container
    docker_gitlab_runner_volumes__custom:
      - /etc/ssl/certs/gitlab_ca.crt:/etc/gitlab-runner/certs/ca.crt
  roles:
    - docker
    - ssl_cert
    - docker_gitlab_runner

Role variables

Variables used by the role:

# GitLab Runner Docker image
docker_gitlab_runner_rimg: gitlab/gitlab-runner

# GitLab Runner Docker image tag
docker_gitlab_runner_rimg_tag: latest

# Name of the Runner container name
docker_gitlab_runner_rname: gitlab-runner

# GitLab Runner name
docker_gitlab_runner_name: "{{ ansible_hostname }}"

# Docker image
docker_gitlab_runner_dimg: docker

# Docker image tag
docker_gitlab_runner_dimg_tag: latest

# Gitlab server URL - must be set by the user
docker_gitlab_runner_server_url: null

# GitLab registration token - must be set by the user
docker_gitlab_runner_reg_token: null

# Docker socket path on the host
docker_gitlab_runner_sock_src: /var/run/docker.sock

# Docker socket path inside the container
docker_gitlab_runner_sock_dst: "{{ docker_gitlab_runner_sock_src }}"

# Default list of docker volumes
docker_gitlab_runner_volumes__default:
  - "{{ docker_gitlab_runner_sock_src }}:{{ docker_gitlab_runner_sock_dst }}"

# Custom list of docker volumes
docker_gitlab_runner_volumes__custom: []

# Final list of docker volumes
docker_gitlab_runner_volumes: "{{
  docker_gitlab_runner_volumes__default +
  docker_gitlab_runner_volumes__custom }}"

# Whether to force registration
docker_gitlab_runner_reg_force: no

# Default registration executor options
docker_gitlab_runner_reg_exec_opts__default:
  executor: docker
  docker-image: "{{ docker_gitlab_runner_dimg }}:{{ docker_gitlab_runner_dimg_tag }}"
  docker-tlsverify: no
  docker-disable-cache: yes
  docker-privileged: yes

# Custom registration executor options
docker_gitlab_runner_reg_exec_opts__custom: {}

# Final registration executor options
docker_gitlab_runner_reg_exec_opts: "{{
  docker_gitlab_runner_reg_exec_opts__default.update(
  docker_gitlab_runner_reg_exec_opts__custom) }}{{
  docker_gitlab_runner_reg_exec_opts__default }}"

# Default registration options
docker_gitlab_runner_reg_opts__default:
  non-interactive: ""
  name: "{{ docker_gitlab_runner_name }}"
  url: "{{ docker_gitlab_runner_server_url }}"
  registration-token: "{{ docker_gitlab_runner_reg_token }}"

# Custom registration options
docker_gitlab_runner_reg_opts__custom: {}

# Final registration options
docker_gitlab_runner_reg_opts: "{{
  docker_gitlab_runner_reg_opts__default.update(
  docker_gitlab_runner_reg_exec_opts) }}{{
  docker_gitlab_runner_reg_opts__default.update(
  docker_gitlab_runner_reg_opts__custom) }}{{
  docker_gitlab_runner_reg_opts__default }}"

Dependencies

License

MIT

Author

Jiri Tyr

ansible-role-docker-gitlab_runner's People

Contributors

jtyr avatar o1da avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.