esp.bitbucket.bitbucket_project (1.4.1) — module

Manage your projects on Bitbucket Server

| "added in version" 1.0.0 of esp.bitbucket"

Authors: Krzysztof Lewandowski (@klewan), Evgeniy Krysanov (@catcombo)

Install collection

Install with ansible-galaxy collection install esp.bitbucket:==1.4.1


Add to requirements.yml

  collections:
    - name: esp.bitbucket
      version: 1.4.1

Description

Manages Bitbucket Server projects.

Authentication can be done with I(token) or with I(username) and I(password).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create project
  esp.bitbucket.bitbucket_project:
    url: 'https://bitbucket.example.com'
    username: admin
    password: secrect
    project_key: FOO
    project_name: A new Bitbucket project
    description: |
        This is a new Bitbucket project.
    validate_certs: no
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create project with custom avatar using token
  esp.bitbucket.bitbucket_project:
    url: 'https://bitbucket.example.com'
    token: 'MjA2M...hqP58'
    project_key: FOO
    name: A new Bitbucket project
    description: |
        This is a new Bitbucket project
    avatar: "{{ lookup('file', 'avatar.png', errors='ignore') | b64encode }}"
    validate_certs: no
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete project
  esp.bitbucket.bitbucket_project:
    url: 'https://bitbucket.example.com'
    username: admin
    password: secrect
    project_key: FOO
    validate_certs: no
    state: absent

Inputs

    
url:
    description:
    - Bitbucket Server URL.
    required: false
    type: str

name:
    aliases:
    - project_name
    description:
    - Bitbucket project name.
    - Required when I(state=present).
    required: false
    type: str

sleep:
    default: 5
    description:
    - Number of seconds to sleep between API retries.
    type: int

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Whether the project should exist or not.
    required: false
    type: str

token:
    description:
    - Token parameter for authentication.
    - This is only needed when not using I(username) and I(password).
    required: false
    type: str

avatar:
    description:
    - Bitbucket project custom avatar. Base64-encoded image data.
    required: false
    type: str

retries:
    default: 3
    description:
    - Number of retries to call Bitbucket API URL before failure.
    type: int

password:
    description:
    - Password used for authentication.
    - This is only needed when not using I(token).
    - Required when I(username) is provided.
    required: false
    type: str

username:
    aliases:
    - user
    description:
    - Username used for authentication.
    - This is only needed when not using I(token).
    - Required when I(password) is provided.
    required: false
    type: str

use_proxy:
    default: true
    description:
    - If C(no), it will not use a proxy, even if one is defined in an environment variable
      on the target hosts.
    type: bool

description:
    description:
    - Bitbucket project description.
    - Required when I(state=present).
    required: false
    type: str

project_key:
    aliases:
    - project
    description:
    - Bitbucket project key.
    required: true
    type: str

return_content:
    default: true
    description:
    - Whether or not to return the body of the response as a "content" key in the dictionary
      result no matter it succeeded or failed.
    type: bool

validate_certs:
    default: true
    description:
    - If C(no), SSL certificates will not be validated.
    - This should only set to C(no) used on personally controlled sites using self-signed
      certificates.
    type: bool

Outputs

description:
  description: Bitbucket project description (if I(state=present)).
  returned: success
  sample: This is a new Bitbucket project
  type: str
id:
  description: Project ID (if I(state=present)).
  returned: success
  sample: 200
  type: int
key:
  description: Bitbucket project key.
  returned: success
  sample: FOO
  type: str
links:
  contains:
    self:
      description: Links to Bitbucket repository.
      elements: dict
      returned: success
      sample:
      - href: https://bitbucket.example.com/projects/FOO
      type: list
  description: Links to Bitbucket project (if I(state=present)).
  returned: success
  type: dict
name:
  description: Bitbucket project name (if I(state=present)).
  returned: success
  sample: A new Bitbucket project
  type: str
public:
  description: Whether or not the project is public (if I(state=present)).
  returned: success
  sample: false
  type: bool
type:
  description: Bitbucket project type (if I(state=present)).
  returned: success
  sample: NORMAL
  type: str