gitlab-ci-variables

gitlab-ci-variables

This role allows to manage Gitlab CI variables using Ansible.

The role can create or update variable value, and also track existing Gitlab CI variables that are not specified in the role configuration.

Build Status Ansible Galaxy

Requirements

Gitlab with v4 API (Gitlab 9.0+).

Installation

ansible-galaxy install peay.gitlab-ci-variables

Usage

Variables are documented in defaults/main.yml.

API URL and token can be specified via

# API token for Gitlab
gitlab_token: "XXXXXXXXXXXXXXXXXXXX"

# API URL for Gitlab
gitlab_api_url: https://some-url-to-gitlab.com/api/v4

Gitlab CI variables can be managed per project. The following example manages variables for two projects.

# Variables to manage for each Gitlab project
gitlab_ci_variables:
  - name: "group/project"
    kind: "project"
    variables:
      - key: VARIABLE_1
        value: value

  - name: "group/project2"
    kind: "project"
    variables:
      - key: VARIABLE_1
        value: value
      - key: VARIABLE_2
        value: value

  - name: "group"
    kind: "group"
    variables:
      - key: VARIABLE_3
        value: value
      - key: VARIABLE_4
        value: value

By default, the role will also check for Gitlab CI variables that are unknown (i.e., not specified in gitlab_ci_variables). This can be disabled using

# When enabled, check for unknown variables in Gitlab
# not managed by this role
gitlab_ci_check_unknown: false

This is purely a check. The role will not remove existing variables that are unknown.

About

Manage Gitlab CI build variables

Install
ansible-galaxy install peay/ansible-gitlab-ci-variables
GitHub repository
License
mit
Downloads
87
Owner