community.general.bitbucket_access_key module – Manages Bitbucket repository access keys

Note

This module is part of the community.general collection (version 6.6.9).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.bitbucket_access_key.

Synopsis

  • Manages Bitbucket repository access keys (also called deploy keys).

Parameters

Parameter

Comments

client_id

string

The OAuth consumer key.

If not set the environment variable BITBUCKET_CLIENT_ID will be used.

client_secret

string

The OAuth consumer secret.

If not set the environment variable BITBUCKET_CLIENT_SECRET will be used.

key

string

The SSH public key.

label

string / required

The key label.

password

string

added in community.general 4.0.0

The App password.

If not set the environment variable BITBUCKET_PASSWORD will be used.

repository

string / required

The repository name.

state

string / required

Indicates desired state of the access key.

Choices:

  • "absent"

  • "present"

user

aliases: username

string

added in community.general 4.0.0

The username.

If not set the environment variable BITBUCKET_USERNAME will be used.

username is an alias of user since community.general 6.0.0. It was an alias of workspace before.

workspace

string / required

The repository owner.

Note: username used to be an alias of this option. Since community.general 6.0.0 it is an alias of user.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • Bitbucket OAuth consumer or App password should have permissions to read and administrate account repositories.

  • Check mode is supported.

  • Bitbucket OAuth consumer key and secret can be obtained from Bitbucket profile -> Settings -> Access Management -> OAuth.

  • Bitbucket App password can be created from Bitbucket profile -> Personal Settings -> App passwords.

  • If both OAuth and Basic Auth credentials are passed, OAuth credentials take precedence.

Examples

- name: Create access key
  community.general.bitbucket_access_key:
    repository: 'bitbucket-repo'
    workspace: bitbucket_workspace
    key: '{{lookup("file", "bitbucket.pub") }}'
    label: 'Bitbucket'
    state: present

- name: Delete access key
  community.general.bitbucket_access_key:
    repository: bitbucket-repo
    workspace: bitbucket_workspace
    label: Bitbucket
    state: absent

Authors

  • Evgeniy Krysanov (@catcombo)