community.general.gitlab_instance_variable module – Creates, updates, or deletes GitLab instance variables
Note
This module is part of the community.general collection (version 8.6.4).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.gitlab_instance_variable
.
New in community.general 7.1.0
Synopsis
Creates a instance variable if it does not exist.
When a instance variable does exist, its value will be updated if the values are different.
Support for instance variables requires GitLab >= 13.0.
Variables which are not mentioned in the modules options, but are present on the GitLab instance, will either stay (
purge=false
) or will be deleted (purge=true
).
Requirements
The below requirements are needed on the host that executes this module.
python-gitlab python module
requests (Python library https://pypi.org/project/requests/)
Parameters
Parameter |
Comments |
---|---|
GitLab CI job token for logging in. |
|
GitLab OAuth token for logging in. |
|
The password to use for authentication against the API. |
|
GitLab access token with API permissions. |
|
The resolvable endpoint for the API. |
|
The username to use for authentication against the API. |
|
The CA certificates bundle to use to verify GitLab server certificate. |
|
When set to Choices:
|
|
Create or delete instance variable. Choices:
|
|
Whether or not to validate SSL certs when supplying a HTTPS endpoint. Choices:
|
|
A list of dictionaries that represents CI/CD variables. Default: |
|
Whether variable value is masked or not. Choices:
|
|
The name of the variable. |
|
Whether variable value is protected or not. Choices:
|
|
The variable value. Required when |
|
Whether a variable is an environment variable ( Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Set or update some CI/CD variables
community.general.gitlab_instance_variable:
api_url: https://gitlab.com
api_token: secret_access_token
purge: false
variables:
- name: ACCESS_KEY_ID
value: abc1312cba
- name: SECRET_ACCESS_KEY
value: 1337
masked: true
protected: true
variable_type: env_var
- name: Delete one variable
community.general.gitlab_instance_variable:
api_url: https://gitlab.com
api_token: secret_access_token
state: absent
variables:
- name: ACCESS_KEY_ID
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Four lists of the variablenames which were added, updated, removed or exist. Returned: always |
|
A list of variables which were created. Returned: always Sample: |
|
A list of variables which were deleted. Returned: always Sample: |
|
A list of variables which exist. Returned: always Sample: |
|
A list pre-existing variables whose values have been set. Returned: always Sample: |