esp.bitbucket.bitbucket_repo_info (1.4.1) — module

Retrieve repositories information for the supplied project

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

Authors: Krzysztof Lewandowski (@klewan)

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

Retrieve repositories information from Bitbucket Server for the supplied project.

Only repositories for which the authenticated user has the REPO_READ permission will be returned.

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: Retrieve all repositories
  esp.bitbucket.bitbucket_repo_info:
    url: 'https://bitbucket.example.com'
    username: jsmith
    password: secrect
    repository: [ '*' ]
    project_key: FOO
    validate_certs: no
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieve the repositories matching the supplied repository filter
  esp.bitbucket.bitbucket_repo_info:
    url: 'https://bitbucket.example.com'
    token: 'MjA2M...hqP58'
    repository: [ bar, baz ]
    project_key: FOO
    validate_certs: no

Inputs

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

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

token:
    description:
    - Token parameter for authentication.
    - This is only needed when not using I(username) and I(password).
    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

repository:
    default:
    - '*'
    description:
    - Retrieve repositories matching the supplied I(repository) filter.
    - This can be '*' which means all repositories.
    required: false
    type: list

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

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

messages:
  description: List of error messages.
  returned: always
  sample:
  - Repository `baz` does not exist.
  type: list
project_key:
  description: Bitbucket project key.
  returned: always
  sample: FOO
  type: str
repositories:
  contains:
    forkable:
      description: Source file used for the copy on the target machine.
      returned: success
      sample: true
      type: bool
    hierarchyId:
      description: Hierarchy ID.
      returned: success
      sample: 91369a5b9598e936d126
      type: str
    id:
      description: Repository ID.
      returned: success
      sample: 100
      type: int
    links:
      contains:
        clone:
          description: Clone URLs.
          elements: dict
          returned: success
          sample:
          - href: https://bitbucket.example.com/scm/foo/bar.git
            name: http
          - href: ssh://git@bitbucket.example.com:7999/foo/bar.git
            name: ssh
          type: list
        self:
          description: Links to Bitbucket repository.
          elements: dict
          returned: success
          sample:
          - href: https://bitbucket.example.com/projects/FOO/repos/bar/browse
          type: list
      description: Links to Bitbucket repository.
      returned: success
      type: dict
    name:
      description: Bitbucket repository name.
      returned: success
      sample: bar
      type: str
    project:
      contains:
        description:
          description: Bitbucket project description.
          returned: success
          sample: This is a Bitbucket project
          type: str
        id:
          description: Project ID.
          returned: success
          sample: 200
          type: int
        key:
          description: Bitbucket project key.
          returned: success
          sample: FOO
          type: str
        name:
          description: Bitbucket project name.
          returned: success
          sample: FOO project
          type: str
        public:
          description: Whether or not the project is public.
          returned: success
          sample: false
          type: bool
        self:
          description: Links to Bitbucket project.
          elements: dict
          returned: success
          sample:
          - href: https://bitbucket.example.com/projects/FOO
          type: list
        type:
          description: Bitbucket project type.
          returned: success
          sample: NORMAL
          type: str
      description: Information about Bitbucket project.
      returned: success
      type: dict
    public:
      description: Whether or not the repository is public.
      returned: success
      sample: true
      type: bool
    scmId:
      description: SCM type.
      returned: success
      sample: git
      type: str
    slug:
      description: Bitbucket repository slug name.
      returned: success
      sample: bar
      type: str
    state:
      description: Bitbucket repository state, after execution.
      returned: success
      sample: AVAILABLE
      type: str
    statusMessage:
      description: Bitbucket repository state message, after execution.
      returned: success
      sample: Available
      type: str
  description: List of repositories.
  returned: always
  type: list