lean_delivery.gitlab_runner
gitlab-runnerロール
概要
このAnsibleロールは以下の機能があります:
- gitlab-runnerをインストールします
要件
- インストールに必要なAnsibleのバージョン: 2.8
- サポートされているOS:
- EL (RedHat, CentOS)
- 7, 8
- Amazon2 Linux
- Ubuntu
- 16.04
- 18.04
- Debian
- 8, 9
- EL (RedHat, CentOS)
ロール変数
- 必須
gitlab_version
Gitlab-Runnerの特定のバージョン。デフォルト値はlatest
。gitlab_api_token
Gitlab APIにアクセスするために必要なトークン。デフォルト値は''
。gitlab_ci_token
Runnerを登録するために取得したトークン。デフォルト値は''
。gitlab_runner_description
Runnerのユニークな名前。デフォルト値:
{{ ansible_fqdn }}
{{ ansible_distribution }}
{{ ansible_distribution_major_version }}
デフォルト
no_logs
ログから機密情報を隠します。デフォルト値はtrue
gitlab_runner_skip_registration
インストール後にgitlab-runnerの登録をスキップします。デフォルト値はfalse
gitlab_host
Docker gitlabサーバー。デフォルト値はgitlab.com
gitlab_url
GitlabのURLアドレス。デフォルト値:https://{{ gitlab_host }}/
gitlab_runner_tags
Runnerに関連付けられたタグ。カンマで区切る必要があります。デフォルト値はdelegated
gitlab_runner_access_level
Runnerが保護ブランチからジョブを取得できるかどうかを決定します。使用可能な値:ref_protected
not_protected
デフォルト値はnot_protected
gitlab_runner_untagged_builds_run
タグのないジョブを取得しないようにする設定。デフォルト値はfalse
gitlab_runner_lock_to_project
Runnerを現在のプロジェクトにロックする設定。デフォルト値はfalse
gitlab_runner_executor
Runnerのエグゼキュータ。デフォルト値はshell
gitlab_runner_extra_options
Runnerの登録プロセスに対する追加オプション。デフォルト値はundefined
gitlab_runner_limit
このトークンが同時に処理できるジョブの数を制限する設定。0
は制限なしを意味します。デフォルト値は1
gitlab_runner_concurrent
同時に実行できるジョブの数を制限します。 定義されたすべてのRunnerを使用してのジョブの上限。 0は無制限を意味しません。デフォルト値はansible_processor_vcpus
gitlab_runner_request_concurrency
GitLabから新しいジョブの同時リクエスト数を制限します。デフォルト値は1
gitlab_runner_env_vars
環境変数を追加または上書きします。デフォルト値は["ENV=value", "LC_ALL=en_US.UTF-8"]
gitlab_runner_package
Gitlab-runnerのパッケージ名。デフォルト:gitlab-runner
gitlab_runner_packages_additional
すべてのインストールのために追加のパッケージをインストールします。デフォルト値は[]
gitlab_runner_gpg
Debian用GPGキー。デフォルト値はhttps://packages.gitlab.com/gpg.key
gitlab_global_section
gitlab設定のグローバルセクション。デフォルトは辞書:
concurrent: '{{ gitlab_runner_request_concurrency }}' check_interval: 0
gitlab_session_server_section
gitlab設定のサーバーセクション。デフォルトは辞書:session_timeout: 1800
gitlab_runners_section
gitlab設定のRunnersセクション。デフォルトは辞書:
name: '{{ gitlab_runner_description }}' url: '{{ gitlab_url }}' token: '{{ gitlab_runner.runner.token | default(omit) }}' executor: '{{ gitlab_runner_executor }}' environment: '{{ gitlab_runner_env_vars }}'
高度な設定
gitlab_runner_config
高度な設定用の辞書:params
登録プロセス中に使用される環境変数global_values
ファイル"config.toml"にキー:値を追加・変更するための辞書で、文字列以外の値を使用global_strings
ファイル"config.toml"にキー:値を追加・変更するための辞書で、文字列の値を使用
追加の変数
yum_libselinux_python_library
Selinux Pythonライブラリ名。デフォルト値:libselinux-python
RedHat 8またはFedoraではライブラリ名が異なる場合があります(例:python3-libselinux
)。yum_libselinux_config_libraries
Selinux設定ライブラリ。デフォルト値はリスト:[policycoreutils-python, libsemanage-python]
。 RedHat 8またはFedoraでは値が異なる場合があります:- python3-policycoreutils
- python3-libsemanage
epel_repository_url
EPELリポジトリパッケージのURL。デフォルト:https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
epel_rpm_key
EPEL rpmキー。デフォルト値:/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}
gitlab_runner_python_module_version
python-gitlabライブラリのバージョン。デフォルト:'1.12.1'
pip_executable
pip実行可能バイナリの名前。デフォルト:- RedHat系ターゲット用の
pip
- Debian系ターゲット用の
pip3
- RedHat系ターゲット用の
python_executable
Python実行可能ファイルの名前。デフォルト:- RedHat系ターゲット用の
python
- Debian系ターゲット用の
python3
- RedHat系ターゲット用の
このロールをインストールする例
playlabsを使用すると、このロールを1つのコマンドでインストールできます:
playlabs install lean_delivery.gitlab_runner @localhost gitlab_ci_token=yourcommand gitlab_host=yourlabs.io gitlab_runner_limit=4 gitlab_version=11.6
または、playlabsを使用せずに、galaxyでインストールして、プレイブックで使用できます:
ansible-galaxy install lean_delivery.gitlab_runner
例プレイブック
登録なしでgitlab-runnerをインストールする:
- name: Converge
hosts: gitlab_runner
roles:
- role: lean_delivery.gitlab_runner
vars:
gitlab_runner_concurrent: 1
gitlab_runner_skip_registration: true
登録および設定ありでgitlab-runnerをインストールする:
- 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
ライセンス
Apache
著者情報
著者:
- Lean Deliveryチーム team@lean-delivery.com
プロジェクトについて
Lean Delivery Gitlab Runner install
インストール
ansible-galaxy install lean_delivery.gitlab_runner
ライセンス
apache-2.0
ダウンロード
43.2k
所有者
Simplify by using!