--- {%- from "mariadb/map.jinja" import mariadb with context %} {%- for name, user in mariadb.users.items() %} mariadb-user-{{ name }}: mysql_user.present: - name: {{ name }} - password: {{ user.password }} - host: '{{ user.host }}' - connection_user: {{ mariadb.connection_user }} - connection_pass: {{ mariadb.connection_pass }} {%- for grant in user.grants %} mariadb-grants-{{ grant.name }}: mysql_grants.present: - name: {{ grant.name }} - grant: '{{ grant.grant }}' - database: '{{ grant.database }}' - user: '{{ name }}' - host: '{{ user.host }}' - connection_user: {{ mariadb.connection_user }} - connection_pass: {{ mariadb.connection_pass }} {%- endfor %} {%- endfor %}