node¶
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 node of a given Kind 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 | |
| branch str |
Default: main |
Branch in which the request is made |
| data raw required |
Dictionary of node attributes | |
| kind str required |
Kind of node to create | |
| state str |
Default: present Choices: absent, present |
Use C(present) or C(absent) for adding or removing. |
| 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.node
gather_facts: false
hosts: localhost
tasks:
- name: Create tag1
opsmill.infrahub.node:
kind: "BuiltinTag"
data:
name: "tag1"
state: present
- name: Delete tag1
opsmill.infrahub.node:
kind: "BuiltinTag"
data:
name: "tag1"
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 object as created or already existent within Infrahub | success (when I(state=present)) |
Authors¶
- Benoit Kohler (@bearchitek)