community.general.gitlab_project_variable – Creates/updates/deletes GitLab Projects Variables¶
Note
This plugin is part of the community.general collection (version 2.5.1).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.gitlab_project_variable
.
Synopsis¶
When a project variable does not exist, it will be created.
When a project 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 project, 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¶
Examples¶
- name: Set or update some CI/CD variables
community.general.gitlab_project_variable:
api_url: https://gitlab.com
api_token: secret_access_token
project: markuman/dotfiles
purge: false
vars:
ACCESS_KEY_ID: abc123
SECRET_ACCESS_KEY: 321cba
- name: Set or update some CI/CD variables
community.general.gitlab_project_variable:
api_url: https://gitlab.com
api_token: secret_access_token
project: markuman/dotfiles
purge: false
vars:
ACCESS_KEY_ID: abc123
SECRET_ACCESS_KEY:
value: 3214cbad
masked: true
protected: true
variable_type: env_var
environment_scope: '*'
- name: Delete one variable
community.general.gitlab_project_variable:
api_url: https://gitlab.com
api_token: secret_access_token
project: markuman/dotfiles
state: absent
vars:
ACCESS_KEY_ID: abc123
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Markus Bergholz (@markuman)