ansible / ansible.builtin / v2.9.27 / module / gitlab_project_variable Creates/updates/deletes GitLab Projects Variables | "added in version" 2.9 of ansible.builtin" Authors: Markus Bergholz (@markuman) preview | supported by communityansible.builtin.gitlab_project_variable (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
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 (I(purge) is C(false)) or will be deleted (I(purge) is C(true)).
- name: Set or update some CI/CD variables 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: Delete one variable gitlab_project_variable: api_url: https://gitlab.com api_token: secret_access_token project: markuman/dotfiles state: absent vars: ACCESS_KEY_ID: abc123
vars: default: {} description: - A list of key value pairs. type: dict purge: default: false description: - When set to true, all variables which are not untouched in the task will be deleted. type: bool state: choices: - present - absent default: present description: - Create or delete project variable. - Possible values are present and absent. type: str api_url: description: - The resolvable endpoint for the API type: str project: description: - The path and name of the project. required: true type: str api_token: description: - GitLab access token with API permissions. required: true type: str api_password: description: - The password to use for authentication against the API type: str api_username: description: - The username to use for authentication against the API type: str validate_certs: default: true description: - Whether or not to validate SSL certs when supplying a https endpoint. type: bool
project_variable: contains: added: description: A list of variables which were created. returned: always sample: '[''ACCESS_KEY_ID'', ''SECRET_ACCESS_KEY'']' type: list removed: description: A list of variables which were deleted. returned: always sample: '[''ACCESS_KEY_ID'', ''SECRET_ACCESS_KEY'']' type: list untouched: description: A list of variables which exist. returned: always sample: '[''ACCESS_KEY_ID'', ''SECRET_ACCESS_KEY'']' type: list updated: description: A list of variables whose values were changed. returned: always sample: '[''ACCESS_KEY_ID'', ''SECRET_ACCESS_KEY'']' type: list description: Four lists of the variablenames which were added, updated, removed or exist. returned: always type: dict