Coder Social home page Coder Social logo

lean-delivery / ansible-role-gitlab-runner Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 11.0 64 KB

Ansible Role - GitLab Runner

Home Page: https://galaxy.ansible.com/lean_delivery/gitlab_runner

License: Apache License 2.0

Python 100.00%
gitlab-runner gitlab-runner-role ansible

ansible-role-gitlab-runner's Introduction

gitlab-runner role

License Build Status Build Status Galaxy Ansible Ansible

Summary

This Ansible role has the following features:

  • Install gitlab-runner

Requirements

  • Version of the ansible for installation: 2.8
  • Supported OS:
    • EL (RedHat, CentOS)
      • 7, 8
    • Amazon2 Linux
    • Ubuntu
      • 16.04
      • 18.04
    • Debian
      • 8, 9

Role Variables

  • required
    • gitlab_version
      Specific version of Gitlab-Runner. Default value is latest.
    • gitlab_api_token
      A token you need to access Gitlab API. Default value is ''.
    • gitlab_ci_token
      A Token you obtained to register the Runner. Default value is ''.
    • gitlab_runner_description
      The unique name of the runner. Default value:
    {{ ansible_fqdn }}
    {{ ansible_distribution }}
    {{ ansible_distribution_major_version }}
  • defaults

    • no_logs
      Hide sensitive information from logs. Default value is true
    • gitlab_runner_skip_registration
      Skip gitlab-runner registration after installation. Default value is false
    • gitlab_host
      Docker gitlab server. Default value is gitlab.com
    • gitlab_url
      Gitlab url address. Default value: https://{{ gitlab_host }}/
    • gitlab_runner_tags
      The tags associated with the Runner. Should be comma delimited. Default value is delegated
    • gitlab_runner_access_level: not_protected
      Determines if a runner can pick up jobs from protected branches. Available values: ref_protected not_protected Default value is not_protected
    • gitlab_runner_untagged_builds_run
      Config that prevents it from picking untagged jobs. Default value is false
    • gitlab_runner_lock_to_project
      Config that lock the Runner to current project. Default value is false
    • gitlab_runner_executor
      Runner executor. Default value is shell
    • gitlab_runner_extra_options
      Extra option for runner registration process. Default value is undefined
    • gitlab_runner_limit
      Config that Limit how many jobs can be handled concurrently by this token. 0 simply means don't limit. Default value is 1
    • gitlab_runner_concurrent
      Limits how many jobs globally can be run concurrently. The most upper limit of jobs using all defined runners. 0 does not mean unlimited. Default value is ansible_processor_vcpus
    • gitlab_runner_request_concurrency
      Limit number of concurrent requests for new jobs from GitLab. Default value is 1
    • gitlab_runner_env_vars
      Append or overwrite environment variables. Default value is ["ENV=value", "LC_ALL=en_US.UTF-8"]
    • gitlab_runner_package Gitlab-runner package name. Default: gitlab-runner
    • gitlab_runner_packages_additional
      Install additional packages for all installs. Default value is []
    • gitlab_runner_gpg
      GPG key for Debian. Default value is https://packages.gitlab.com/gpg.key
    • gitlab_global_section
      Global section of gitclab config. Default is dictionary:
      concurrent: '{{ gitlab_runner_request_concurrency }}'
      check_interval: 0
    • gitlab_session_server_section
      Server section of gitlab config. Default is dictionary: session_timeout: 1800
    • gitlab_runners_section
      Runners section of gitlab config. Default is dictionary:
      name: '{{ gitlab_runner_description }}'
      url: '{{ gitlab_url }}'
      token: '{{ gitlab_runner.runner.token | default(omit) }}'
      executor: '{{ gitlab_runner_executor }}'
      environment: '{{ gitlab_runner_env_vars }}'
  • advanced configuration

    • gitlab_runner_config
      Dictionary used for advanced configs:
      • params
        Environment variables used during the registration process
      • global_values
        Dictionary with key:value used to add/change non string values in the file "config.toml"
      • global_strings
        Dictionary with key:value used to add/change string values in the file "config.toml"
  • additional variables

    • yum_libselinux_python_library
      Selinux python library name. Default value: libselinux-python For RedHat 8 or Fedora library name may be different, e.g. python3-libselinux.
    • yum_libselinux_config_libraries
      Selinux config libraries. Default value is list: [policycoreutils-python, libsemanage-python]. For RedHat 8 or Fedora value may be different:
      • python3-policycoreutils
      • python3-libsemanage
    • epel_repository_url
      URL of EPEL repo package. Default: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
    • epel_rpm_key
      EPEL rpm key. Default value: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}
    • gitlab_runner_python_module_version
      Version of python-gitlab library. Default: '1.12.1'
    • pip_executable
      Name of pip executable binary. Default:
      • pip for RedHat based targets
      • pip3 for Debian based targets
    • python_executable
      Name of python executable. Default:
      • python for RedHat based targets
      • python3 for Debian based targets

Some examples of the installing current role

With playlabs you can install this role with just one command, ie:

playlabs install lean_delivery.gitlab_runner @localhost gitlab_ci_token=yourcommand gitlab_host=yourlabs.io gitlab_runner_limit=4 gitlab_version=11.6

Or, without playlabs, install with galaxy so that you can use with your playbook:

ansible-galaxy install lean_delivery.gitlab_runner

Example Playbook

Installing gitlab-runner without registration:

- name: Converge
  hosts: gitlab_runner
  roles:
    - role: lean_delivery.gitlab_runner
  vars:
    gitlab_runner_concurrent: 1
    gitlab_runner_skip_registration: true

Installing gitlab-runner with registration and config:

- name: Converge
  hosts: gitlab_runner
  roles:
    - role: lean_delivery.gitlab_runner
      gitlab_runner_concurrent: 4
      gitlab_runner_skip_registration: false
      gitlab_api_token: >-
        {{ lookup('env', 'GITLAB_API_TOKEN') }}
      gitlab_ci_token: >-
        {{ lookup('env', 'GITLAB_REGISTRATION_TOKEN') }}
      gitlab_runner_description: 'My Great Runner'
      gitlab_runner_tags:
        - deploy_test
        - shell
      gitlab_runner_untagged_builds_run: false
      gitlab_runner_concurrent: 1
      gitlab_version: '12.5.1'
      gitlab_runner_skip_registration: false

License

Apache

License

Author Information

authors:

ansible-role-gitlab-runner's People

Contributors

cedriclevasseur avatar jpic avatar kharkevich avatar mprenditore avatar pavelpikta avatar tgadiev avatar vutkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-gitlab-runner's Issues

gitlab_runner_lock_to_project does not work.

SUMMARY

gitlab_runner_lock_to_project does not work how with true value and false value.
Also after register I have checkbox on "Protected" and i can't regulate this parameter. Could you add it in the future?

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION

2.9.1

CONFIGURATION
OS / ENVIRONMENT

Centos 7

STEPS TO REPRODUCE

I just use ansible-playbook with the next parameters:

  • role: lean_delivery.gitlab_runner
    gitlab_runner_skip_registration: false
    gitlab_url: "https://git.epam.com/"
    gitlab_api_token: ""
    gitlab_ci_token: "
    "
    gitlab_runner_description: "contribute-stage"
    gitlab_runner_env_vars: ["JAVA_HOME=/usr/bin/java"]
    gitlab_runner_tags:
    - contribute-stage
    gitlab_runner_untagged_builds_run: false
    gitlab_runner_concurrent: 1
    gitlab_runner_request_concurrency: 1
    gitlab_runner_lock_to_project: true
    no_logs: false
EXPECTED RESULTS
ACTUAL RESULTS

register gitlab-runner skipping

SUMMARY

Hello, I'm trying to use your role to register my gitlab-runner, but the task that registers is giving skip., Is there any obligatory variable besides the token and url for me to register?

ISSUE TYPE
  • Documentation Report
COMPONENT NAME
ANSIBLE VERSION
2.7.8
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
---
- hosts: all
  gather_facts: yes
  # connection: local
  tasks:
    - name: Register gitlab runner
      include_role:
        name: '../'
      vars:
       gitlab_runner_concurrent: 1
       gitlab_runner_skip_registration: true
EXPECTED RESULTS
ACTUAL RESULTS

ci token check failure

The 'when' condition in handlers/main.yml for the 'gitlab_ci_token' fails if a token is specified

when:
    ...
    gitlab_ci_token | length > 0

resolves the problem.

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.