community / community.general / 1.3.11 / module / gitlab_deploy_key Manages GitLab project deploy keys. Authors: Marcus Watkins (@marwatk), Guillaume Martinez (@Lunik)community.general.gitlab_deploy_key (1.3.11) — module
Install with ansible-galaxy collection install community.general:==1.3.11
collections: - name: community.general version: 1.3.11
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: yes
- 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 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. type: str title: description: - Deploy key's title. required: true type: str api_url: description: - The resolvable endpoint for the API type: str 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 token for logging in. 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
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