Use http.query instead of nbroles module
All checks were successful
ci/lysergic/push/pipeline Pipeline was successful
All checks were successful
ci/lysergic/push/pipeline Pipeline was successful
This is an attempt to remove the need for the custom nbroles module. If it works out, the localhost reference should be replaced with a global roles API endpoint. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
06a36e62ae
commit
0efd688151
@ -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
|
||||
|
@ -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 %}
|
||||
|
@ -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 }}:
|
||||
'*':
|
||||
|
Loading…
Reference in New Issue
Block a user