community / community.general / 8.5.0 / module / gitlab_deploy_key Manages GitLab project deploy keys Authors: Marcus Watkins (@marwatk), Guillaume Martinez (@Lunik)community.general.gitlab_deploy_key (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Adds, updates and removes project deploy keys
- name: "Adding a project deploy key" community.general.gitlab_deploy_key: api_url: https://gitlab.example.com/ api_token: "{{ api_token }}" project: "my_group/my_project" title: "Jenkins CI" state: present key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..."
- name: "Update the above deploy key to add push access" community.general.gitlab_deploy_key: api_url: https://gitlab.example.com/ api_token: "{{ api_token }}" project: "my_group/my_project" title: "Jenkins CI" state: present can_push: true
- name: "Remove the previous deploy key from the project" community.general.gitlab_deploy_key: api_url: https://gitlab.example.com/ api_token: "{{ api_token }}" project: "my_group/my_project" state: absent key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..."
key: description: - Deploy key required: true type: str state: choices: - present - absent default: present description: - When V(present) the deploy key added to the project if it doesn't exist. - When V(absent) it will be removed from the project if it exists. type: str title: description: - Deploy key's title. required: true type: str api_url: description: - The resolvable endpoint for the API. type: str ca_path: description: - The CA certificates bundle to use to verify GitLab server certificate. type: str version_added: 8.1.0 version_added_collection: community.general project: description: - Id or Full path of project in the form of group/name. required: true type: str can_push: default: false description: - Whether this key can push to the project. type: bool api_token: description: - GitLab access token with API permissions. 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 api_job_token: description: - GitLab CI job token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general validate_certs: default: true description: - Whether or not to validate SSL certs when supplying a HTTPS endpoint. type: bool api_oauth_token: description: - GitLab OAuth token for logging in. type: str version_added: 4.2.0 version_added_collection: community.general
deploy_key: description: API object returned: always type: dict error: description: the error message returned by the GitLab API returned: failed sample: '400: key is already in use' type: str msg: description: Success or failure message returned: always sample: Success type: str result: description: json parsed response from the server returned: always type: dict