branch¶
Collection Note
This module is part of the opsmill.infrahub collection. To install the collection, use:
Added in version1.4.0.
You need further requirements to be able to use this module, see the Requirements section for details.
Synopsis¶
- Creates, Updates or Deletes a branch (InrahubBranch) in Infrahub through Infrahub SDK
Requirements¶
The following Python packages are needed on the host that executes this module:
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| api_endpoint str required |
Endpoint of the Infrahub API, optional env=INFRAHUB_ADDRESS | |
| description str |
Description of the branch | |
| name str required |
Name of the branch to create | |
| state str |
Default: present Choices: absent, present |
Use C(present) or C(absent) for adding or removing. |
| sync_with_git bool |
Whether to sync the branch with git | |
| timeout int |
Default: 10 |
Timeout for Infrahub requests in seconds |
| token str required |
The API token created through Infrahub, optional env=INFRAHUB_API_TOKEN | |
| validate_certs bool |
Default: True |
Whether or not to validate SSL of the Infrahub instance |
Examples¶
---
- name: Infrahub playbook for opsmill.infrahub.branch
gather_facts: false
hosts: localhost
tasks:
- name: Create a Branch 'test'
opsmill.infrahub.branch:
name: "test"
sync_with_git: false
description: "This is a test branch"
state: present
- name: Delete a Branch 'test'
opsmill.infrahub.branch:
name: "test"
state: absent
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| msg | str | Message indicating failure or info about what has been achieved | always |
| object | dict | Serialized Branch object as created or already existent within Infrahub | success (when I(state=present)) |
Authors¶
- Benoit Kohler (@bearchitek)