<commit_before>#!jinja|yaml

{% set ENVIRONMENT = salt.environ.get('ENVIRONMENT') %}
{% set environment = salt.pillar.get('environments:{}'.format(ENVIRONMENT)) %}
{% set purposes = environment.purposes %}

{% for dbconfig in environment.backends.rds %}
{% if dbconfig.engine == 'postgres' %}
{% set postgresql_host = 'postgresql-{}.service.{}.consul'.format(dbconfig.name, ENVIRONMENT) %}
{% set postgresql_port = 5432 %}
{% set postgresql_creds = salt.vault.read(
    '{engine}-{env}-{dbname}/creds/admin'.format(
        engine=dbconfig.engine, env=ENVIRONMENT, dbname=dbconfig.name)) %}

create_db_app_role_{{ dbconfig.name }}:
  postgres_group.present:
    - name: {{ dbconfig.name }}
    - createdb: False
    - createroles: False
    - createuser: False
    - login: False
    - superuser: False
    - inherit: False
    - refresh_password: True
    - db_user: {{ postgresql_creds.data.username }}
    - db_password: {{ postgresql_creds.data.password }}
    - db_host: {{ postgresql_host }}<commit_msg>Fixed DNS name for postgres consul service<commit_after>#!jinja|yaml

{% set ENVIRONMENT = salt.environ.get('ENVIRONMENT') %}
{% set environment = salt.pillar.get('environments:{}'.format(ENVIRONMENT)) %}
{% set purposes = environment.purposes %}

{% for dbconfig in environment.backends.rds %}
{% if dbconfig.engine == 'postgres' %}
{% set postgresql_host = 'postgres-{}.service.{}.consul'.format(dbconfig.name, ENVIRONMENT) %}
{% set postgresql_port = 5432 %}
{% set postgresql_creds = salt.vault.read(
    '{engine}-{env}-{dbname}/creds/admin'.format(
        engine=dbconfig.engine, env=ENVIRONMENT, dbname=dbconfig.name)) %}

create_db_app_role_{{ dbconfig.name }}:
  postgres_group.present:
    - name: {{ dbconfig.name }}
    - createdb: False
    - createroles: False
    - createuser: False
    - login: False
    - superuser: False
    - inherit: False
    - refresh_password: True
    - db_user: {{ postgresql_creds.data.username }}
    - db_password: {{ postgresql_creds.data.password }}
    - db_host: {{ postgresql_host }}
{'fraction_non_alphanumeric': 0.15843520782396087, 'fraction_numerical': 0.003911980440097799, 'mean_word_length': 4.002444987775061, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6882770', 'n_tokens_mistral': 745, 'n_tokens_neox': 701, 'n_words': 118}