From bf0dfeb9411a7b7c4b5d3fb0ded70d6943ba82ae Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sat, 21 Jan 2023 01:00:22 +0100 Subject: Use nbroles instead of grains Signed-off-by: Georg Pfuetzenreuter --- salt/_modules/nbroles.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 salt/_modules/nbroles.py (limited to 'salt/_modules') diff --git a/salt/_modules/nbroles.py b/salt/_modules/nbroles.py new file mode 100644 index 0000000..54c4b79 --- /dev/null +++ b/salt/_modules/nbroles.py @@ -0,0 +1,12 @@ +#to-do: tidy this up, make host configurable + +import requests + +host = 'http://127.0.0.1:5000/roles?machine=' + +def get(name): + req = requests.get(host + name) + if req.status_code == 404: + return([]) + if req.status_code == 200: + return(req.json()['roles']) -- cgit v1.2.3