Skip to content
Snippets Groups Projects
Commit 22d08ec1 authored by Heinz Wiesinger's avatar Heinz Wiesinger
Browse files

Add support for fetching user hosts from salt mine.

parent 7c683825
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,16 @@ include:
{% set user_hosts = salt['pillar.get']('mysql:user:%s:hosts'|format(name)) %}
{% endif %}
{% if not user_hosts %}
{% set mine_target = salt['pillar.get']('mysql:user:%s:mine_hosts:target'|format(name)) %}
{% set mine_function = salt['pillar.get']('mysql:user:%s:mine_hosts:function'|format(name)) %}
{% set mine_expression_form = salt['pillar.get']('mysql:user:%s:mine_hosts:expr_form'|format(name)) %}
{% if mine_target and mine_function and mine_expression_form %}
{% set user_hosts = salt['mine.get'](mine_target, mine_function, mine_expression_form).values() %}
{% endif %}
{% endif %}
{% for host in user_hosts %}
{% set state_id = 'mysql_user_' ~ name ~ '_' ~ host%}
......
......@@ -81,6 +81,15 @@ mysql:
password: ~
host: localhost
databases: []
application:
password: 'somepass'
mine_hosts:
target: "G@role:database and *.example.com"
function: "network.get_hostname"
expr_form: compound
databases:
- database: foo
grants: ['select', 'insert', 'update']
# Override any names defined in map.jinja
lookup:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment