Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2016 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/92855045225c75d10a8af65439aa0932 to your computer and use it in GitHub Desktop.
Save anonymous/92855045225c75d10a8af65439aa0932 to your computer and use it in GitHub Desktop.
Results of cp.get_file_str
-------------------------
# TYPE DATABASE USER CIDR-ADDRESS METHOD
{%- set postgres_databases = salt['pillar.get']('postgres:databases') %}
{%- for server, hba_config in salt['mine.get']('*', 'postgres-hba').items() %}
{{ '\n### '~server~' ###' }}
{%- for hba, hba_props in hba_config.iteritems() %}
{{ '\n# '~hba }}
{%- for id, hba_entry in hba_props.iteritems() %}
{{ hba_entry.get('type') }} {{ postgres_databases[hba_entry.get('database_connection')]['database'] }} {{ postgres_databases[hba_entry.get('database_connection')]['user'] }}{% if 'cidr' in hba_entry %} {{ hba_entry.get('cidr') }}{% endif %} {{ hba_entry.get('method') }}
{%- endfor %}
{%- endfor %}
{%- endfor %}
Results of cp.get_template
--------------------------
# TYPE DATABASE USER CIDR-ADDRESS METHOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment