esp.bitbucket.bitbucket_clone (1.4.1) — module

Clone a repository from Bitbucket Server

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

Authors: Pawel Smolarz (pawel.smolarz@nordea.com), 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

Clones a repository from Bitbucket Server.

Returns the latest commit hash of the cloned repository branch.

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: Clone a repository from Bitbucket
  esp.bitbucket.bitbucket_clone:
    url: 'https://bitbucket.example.com'
    username: jsmith
    password: secrect
    repository: bar
    project_key: FOO
    branch: master
    path: /tmp/bar  
    force: yes
    validate_certs: no
  register: _result

Inputs

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

force:
    default: false
    description:
    - Delete a local destination directory before cloning, if it already exists.
    required: false
    type: bool

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

branch:
    default: master
    description:
    - A repository branch to clone.
    required: false
    type: str

repodir:
    aliases:
    - path
    description:
    - A local destination directory where the repository will be cloned.
    - This must be a valid git repository.
    required: true
    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:
    aliases:
    - path
    description:
    - Repository name.
    required: true
    type: str

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

changed:
  description: Whether or not a repository has been cloned from Bitbucket.
  returned: success
  sample: true
  type: bool
json:
  contains:
    commit_hexsha:
      description: A commit hash of the working tree of the cloned repository branch.
      returned: success
      sample: 9074a0e7140e120ae927cb817c0d6fc7ebf6dd37
      type: str
  description: Dictionary with clone details.
  returned: success
  type: dict