community.general.bitbucket_pipeline_known_host module – Manages Bitbucket pipeline known hosts

Note

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

You might already have this collection installed if you are using the ansible package. 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_pipeline_known_host.

Synopsis

  • Manages Bitbucket pipeline known hosts under the “SSH Keys” menu.

  • The host fingerprint will be retrieved automatically, but in case of an error, one can use key field to specify it manually.

Requirements

The below requirements are needed on the host that executes this module.

  • paramiko

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 public key.

name

string / required

The FQDN of the known host.

password

string

added in 4.0.0 of community.general

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 record.

Choices:

  • absent

  • present

user

string

added in 4.0.0 of community.general

The username.

If not set the environment variable BITBUCKET_USERNAME will be used.

workspace

aliases: username

string / required

The repository owner.

Alias username has been deprecated and will become an alias of user in community.general 6.0.0.

Notes

Note

  • 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 known hosts from the list
  community.general.bitbucket_pipeline_known_host:
    repository: 'bitbucket-repo'
    workspace: bitbucket_workspace
    name: '{{ item }}'
    state: present
  with_items:
    - bitbucket.org
    - example.com

- name: Remove known host
  community.general.bitbucket_pipeline_known_host:
    repository: bitbucket-repo
    workspace: bitbucket_workspace
    name: bitbucket.org
    state: absent

- name: Specify public key file
  community.general.bitbucket_pipeline_known_host:
    repository: bitbucket-repo
    workspace: bitbucket_workspace
    name: bitbucket.org
    key: '{{lookup("file", "bitbucket.pub") }}'
    state: absent

Authors

  • Evgeniy Krysanov (@catcombo)