Skip to main content

Modules modules

Fetch the content of an artifact from Infrahub through Infrahub SDK

Parameters

ParameterTypeRequiredDefaultDescription
api_endpointstrNoEndpoint of the Infrahub API, optional env=INFRAHUB_ADDRESS
tokenstrNoThe API token created through Infrahub, optional env=INFRAHUB_API_TOKEN
timeoutintNo10Timeout for Infrahub requests in seconds
artifact_namestrYesName of the artifact
target_idstrYesId of the target for this artifact
branchstrNomainBranch in which the request is made
validate_certsboolNoTrueWhether or not to validate SSL of the Infrahub instance

Examples

---
- name: Infrahub action plugin artifact_fetch
gather_facts: false
hosts: platform_eos
vars:
ansible_become: true

tasks:
- name: Query Startup Config for Edge Devices
opsmill.infrahub.artifact_fetch:
artifact_name: "Startup Config for Edge devices"
target_id: "{{ id }}"
register: startup_artifact

- name: Save configs to localhost
ansible.builtin.copy:
content: "{{ startup_artifact.text }}"
dest: "/tmp/{{ inventory_hostname }}-startup.conf"
mode: '644'
delegate_to: localhost

Return values

KeyTypeDescription
jsondictContent of the artifact in JSON format.
textstrContent of the artifact in TEXT format.