mirror of
https://github.com/Infisical/ansible-collection.git
synced 2025-04-06 18:50:32 -07:00
push init collection setup
This commit is contained in:
parent
a7bc303927
commit
8779acc489
2 changed files with 30 additions and 0 deletions
13
galaxy.yml
Normal file
13
galaxy.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace: "maidul98"
|
||||||
|
name: "infisical"
|
||||||
|
version: "1.0.0"
|
||||||
|
description: The Infisical collection.
|
||||||
|
readme: "README.md"
|
||||||
|
authors:
|
||||||
|
- "Infisical (https://infisical.com)"
|
||||||
|
license:
|
||||||
|
- "MIT"
|
||||||
|
tags:
|
||||||
|
- demo
|
||||||
|
- collection
|
||||||
|
repository: "https://github.com/Infisical/ansible-collection"
|
17
plugins/lookup/fetch_data.py
Normal file
17
plugins/lookup/fetch_data.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
from ansible.errors import AnsibleError
|
||||||
|
from ansible.plugins.lookup import LookupBase
|
||||||
|
import requests
|
||||||
|
|
||||||
|
class LookupModule(LookupBase):
|
||||||
|
|
||||||
|
def run(self, terms, variables=None, **kwargs):
|
||||||
|
# URL from the terms or you can define it within the plugin
|
||||||
|
url = terms[0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.get(url)
|
||||||
|
response.raise_for_status() # Raise HTTPError for bad responses (4xx and 5xx)
|
||||||
|
return [response.json()]
|
||||||
|
except requests.RequestException as e:
|
||||||
|
raise AnsibleError("Error fetching data from {}: {}".format(url, e))
|
||||||
|
|
Loading…
Add table
Reference in a new issue