Use nbroles instead of grains
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
2181a4999f
commit
bf0dfeb941
@ -1,5 +1,5 @@
|
|||||||
{% set roles = salt['grains.get']('roles', []) %}
|
{%- set id = salt['grains.get']('id') -%}
|
||||||
{% set id = salt['grains.get']('id') %}
|
{%- set roles = salt['nbroles.get'](id) -%}
|
||||||
|
|
||||||
{{ saltenv }}:
|
{{ saltenv }}:
|
||||||
'*':
|
'*':
|
||||||
|
12
salt/_modules/nbroles.py
Normal file
12
salt/_modules/nbroles.py
Normal file
@ -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'])
|
@ -1,5 +1,5 @@
|
|||||||
{% set client_id = salt['grains.get']('id') %}
|
{%- set id = salt['grains.get']('id') -%}
|
||||||
{% set roles = salt['grains.get']('roles', []) %}
|
{%- set roles = salt['nbroles.get'](id) -%}
|
||||||
|
|
||||||
{{ saltenv }}:
|
{{ saltenv }}:
|
||||||
'*':
|
'*':
|
||||||
|
Loading…
Reference in New Issue
Block a user