summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/nbroles_to_grains.sh2
-rw-r--r--pillar/top.sls4
-rw-r--r--salt/top.sls2
3 files changed, 4 insertions, 4 deletions
diff --git a/bin/nbroles_to_grains.sh b/bin/nbroles_to_grains.sh
index 4d955fb..ee4e726 100755
--- a/bin/nbroles_to_grains.sh
+++ b/bin/nbroles_to_grains.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
# This rewrites top-files to fetch roles from grains instead of our custom roles API. Useful for testing outside of the LibertaCasa infrastructure, but not recommended for production.
-sed -i "s/salt\['nbroles.get'\](id)/grains\['roles'\]/" */top.sls
+sed -i "s/salt\['http.query'\].*/grains\['roles'\] -%}/" */top.sls
diff --git a/pillar/top.sls b/pillar/top.sls
index 3302bd8..13efc78 100644
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -1,5 +1,5 @@
{%- set id = salt['grains.get']('id') -%}
-{%- set roles = salt['nbroles.get'](id) -%}
+{%- set roles = salt['http.query']('http://127.0.0.1:5000/roles', decode=True, decode_type='json', params={"machine": id})['dict']['roles'] -%}
{{ saltenv }}:
'*':
@@ -7,6 +7,6 @@
'{{ id }}':
- ignore_missing: True
- id.{{ id.replace('.', '_') }}
- {% for role in roles %}
+ {%- for role in roles %}
- role.{{ role }}
{%- endfor %}
diff --git a/salt/top.sls b/salt/top.sls
index 632d4a2..6b92f79 100644
--- a/salt/top.sls
+++ b/salt/top.sls
@@ -1,5 +1,5 @@
{%- set id = salt['grains.get']('id') -%}
-{%- set roles = salt['nbroles.get'](id) -%}
+{%- set roles = salt['http.query']('http://127.0.0.1:5000/roles', decode=True, decode_type='json', params={"machine": id})['dict']['roles'] -%}
{{ saltenv }}:
'*':