community.general.gitlab_group_variable – Creates, updates, or deletes GitLab groups variables
Note
This plugin is part of the community.general collection (version 3.8.3).
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
.
To use it in a playbook, specify: community.general.gitlab_group_variable
.
New in version 1.2.0: of community.general
Synopsis
Creates a group variable if it does not exist.
When a group variable does exist, its value will be updated when the values are different.
Variables which are untouched in the playbook, but are not untouched in the GitLab group, they stay untouched (purge is
false
) or will be deleted (purge istrue
).
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.7
python-gitlab python module
Parameters
Parameter |
Comments |
---|---|
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 path and name of the group. |
|
When set to Choices:
|
|
Create or delete group variable. Choices:
|
|
Whether or not to validate SSL certs when supplying a https endpoint. Choices:
|
|
When the list element is a simple key-value pair, set masked and protected to false. When the list element is a dict with the keys value, masked and protected, the user can have full control about whether a value should be masked, protected or both. Support for protected values requires GitLab >= 9.3. Support for masked values requires GitLab >= 11.10. A value must be a string or a number. Field variable_type must be a string with either When a value is masked, it must be in Base64 and have a length of at least 8 characters. See GitLab documentation on acceptable values for a masked variable (https://docs.gitlab.com/ce/ci/variables/#masked-variables). Default: {} |
Examples
- name: Set or update some CI/CD variables
community.general.gitlab_group_variable:
api_url: https://gitlab.com
api_token: secret_access_token
group: scodeman/testgroup/
purge: false
vars:
ACCESS_KEY_ID: abc123
SECRET_ACCESS_KEY: 321cba
- name: Set or update some CI/CD variables
community.general.gitlab_group_variable:
api_url: https://gitlab.com
api_token: secret_access_token
group: scodeman/testgroup/
purge: false
vars:
ACCESS_KEY_ID: abc123
SECRET_ACCESS_KEY:
value: 3214cbad
masked: true
protected: true
variable_type: env_var
- name: Delete one variable
community.general.gitlab_group_variable:
api_url: https://gitlab.com
api_token: secret_access_token
group: scodeman/testgroup/
state: absent
vars:
ACCESS_KEY_ID: abc123
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: “[\u0027ACCESS_KEY_ID\u0027, \u0027SECRET_ACCESS_KEY\u0027]” |
|
A list of variables which were deleted. Returned: always Sample: “[\u0027ACCESS_KEY_ID\u0027, \u0027SECRET_ACCESS_KEY\u0027]” |
|
A list of variables which exist. Returned: always Sample: “[\u0027ACCESS_KEY_ID\u0027, \u0027SECRET_ACCESS_KEY\u0027]” |
|
A list of variables whose values were changed. Returned: always Sample: “[\u0027ACCESS_KEY_ID\u0027, \u0027SECRET_ACCESS_KEY\u0027]” |
Authors
Florent Madiot (@scodeman)