<commit_before>#
# Create MySQL databases, users and privileges
#

{%- from 'settings/init.sls' import settings with context %}
{%- for environment, environment_details in settings.environments.items() %}
{%- for store in pillar.stores %}

# create database - zed
mysql_database_{{ store }}_{{ environment }}_zed:
  mysql_database.present:
    - name: {{ settings.environments[environment].stores[store].zed.database.database }}
    - require:
      - pkg: python-mysqldb
{% if salt['pillar.get']('hosting:external_mysql', '') == '' %}
      - service: mysqld
{% endif %}

# create database - dump
mysql_database_{{ store }}_{{ environment }}_zed_dump:
  mysql_database.present:
    - name: {{ settings.environments[environment].stores[store].dump.database.database }}
    - require:
      - pkg: python-mysqldb
{% if salt['pillar.get']('hosting:external_mysql', '') == '' %}
      - service: mysqld
{% endif %}

# create database user
mysql_users_{{ store }}_{{ environment }}:
  mysql_user.present:
    - name: {{ settings.environments[environment].stores[store].zed.database.username }}
    - host: "{{ salt['pillar.get']('hosting:mysql_network', '%') }}"
    - password: {{ settings.environments[environment].stores[store].zed.database.password }}
    - require:
      - pkg: mysql_python_pkgs
{% if salt['pillar.get']('hosting:external_mysql', '') == '' %}
      - service: mysqld
{% endif %}

# create database permissions (zed database)
mysql_grants_{{ store }}_{{ environment }}_zed:
  mysql_grants.present:
    - grant: all
    - database: {{ settings.environments[environment].stores[store].zed.database.database }}.*
    - user: {{ settings.environments[environment].stores[store].zed.database.username }}<commit_msg>Update mysql_user.present parameters<commit_after>#
# Create MySQL databases, users and privileges
#

{%- from 'settings/init.sls' import settings with context %}
{%- for environment, environment_details in settings.environments.items() %}
{%- for store in pillar.stores %}

# create database - zed
mysql_database_{{ store }}_{{ environment }}_zed:
  mysql_database.present:
    - name: {{ settings.environments[environment].stores[store].zed.database.database }}
    - require:
      - pkg: python-mysqldb
{% if salt['pillar.get']('hosting:external_mysql', '') == '' %}
      - service: mysqld
{% endif %}

# create database - dump
mysql_database_{{ store }}_{{ environment }}_zed_dump:
  mysql_database.present:
    - name: {{ settings.environments[environment].stores[store].dump.database.database }}
    - require:
      - pkg: python-mysqldb
{% if salt['pillar.get']('hosting:external_mysql', '') == '' %}
      - service: mysqld
{% endif %}

# create database user
mysql_users_{{ store }}_{{ environment }}:
  mysql_user.present:
    - name: {{ settings.environments[environment].stores[store].zed.database.username }}
    - host: "{{ salt['pillar.get']('hosting:mysql_network', '%') }}"
    - password: {{ settings.environments[environment].stores[store].zed.database.password }}
    - connection_host: {{ settings.environments[environment].stores[store].zed.database.hostname }}
    - connection_user: {{ settings.environments[environment].stores[store].zed.database.username }}
    - connection_pass: {{ settings.environments[environment].stores[store].zed.database.password }}
    - connection_charset: utf8
    - require:
      - pkg: mysql_python_pkgs
{% if salt['pillar.get']('hosting:external_mysql', '') == '' %}
      - service: mysqld
{% endif %}

# create database permissions (zed database)
mysql_grants_{{ store }}_{{ environment }}_zed:
  mysql_grants.present:
    - grant: all
    - database: {{ settings.environments[environment].stores[store].zed.database.database }}.*
    - user: {{ settings.environments[environment].stores[store].zed.database.username }}
{'fraction_non_alphanumeric': 0.16745406824146983, 'fraction_numerical': 0.00026246719160104987, 'mean_word_length': 4.360056258790436, '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': '5440513', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1126, 'n_words': 200}