ansible / ansible.builtin / v2.6.2 / module / gitlab_deploy_key Manages GitLab project deploy keys. | "added in version" 2.6 of ansible.builtin" Authors: Marcus Watkins (@marwatk) preview | supported by communityansible.builtin.gitlab_deploy_key (v2.6.2) — module
pip
Install with pip install ansible==2.6.2
Adds, updates and removes project deploy keys
# Example adding a project deploy key - gitlab_deploy_key: api_url: https://gitlab.example.com/api access_token: "{{ access_token }}" project: "my_group/my_project" title: "Jenkins CI" state: present key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..."
# Update the above deploy key to add push access - gitlab_deploy_key: api_url: https://gitlab.example.com/api access_token: "{{ access_token }}" project: "my_group/my_project" title: "Jenkins CI" state: present key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..." can_push: yes
# Remove the previous deploy key from the project - gitlab_deploy_key: api_url: https://gitlab.example.com/api access_token: "{{ access_token }}" project: "my_group/my_project" state: absent key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..."
key: description: - Deploy key required: true state: choices: - present - absent default: present description: - When C(present) the deploy key added to the project if it doesn't exist. - When C(absent) it will be removed from the project if it exists required: true title: description: - Deploy key's title required: true api_url: description: - GitLab API url, e.g. https://gitlab.example.com/api required: true project: description: - Numeric project id or name of project in the form of group/name required: true can_push: default: 'no' description: - Whether this key can push to the project type: bool access_token: description: - The oauth key provided by GitLab. One of access_token or private_token is required. See https://docs.gitlab.com/ee/api/oauth2.html required: false private_token: description: - Personal access token to use. One of private_token or access_token is required. See https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html required: false
error: description: the error message returned by the Gitlab API returned: failed sample: '400: key is already in use' type: string msg: description: Success or failure message returned: always sample: Success type: string previous_version: description: object describing the state prior to this task returned: changed type: dict result: description: json parsed response from the server returned: always type: dict