<commit_before>---
- name: Create database of sites
  mysql_db:
    name: "{{ site_env.db_name }}"
    state: present
    login_host: "{{ site_env.db_host }}"
    login_user: "{{ mysql_root_user }}"
    login_password: "{{ <PASSWORD> }}"
  with_dict: "{{ craft_sites }}"
  when: site_uses_local_db and item.value.db_create | default(True)

- name: Create/assign database user to db and grant permissions
  mysql_user:
    name: "{{ site_env.db_user }}"
    password: "{{ site_env.db_password }}"
    host: "{{ site_env.db_user_host }}"
    append_privs: yes
    priv: "{{ site_env.db_name }}.*:ALL"
    state: present
    login_host: "{{ site_env.db_host }}"
    login_user: "{{ mysql_root_user }}"
    login_password: "{{ <PASSWORD> }}"
  with_dict: "{{ craft_sites }}"
  when: site_uses_local_db and item.value.db_create | default(True)

- name: Copy database dump
  copy:
    src: "{{ item.value.db_import }}"
    dest: /tmp
  with_dict: "{{ craft_sites }}"
  when: item.value.db_import | default(False)

- name: Import database
  mysql_db:
    name: "{{ site_env.db_name }}"
    state: import
    target: "/tmp/{{ item.value.db_import | basename }}"<commit_msg>Restrict MySQL user privileges to minimum required<commit_after>---
- name: Create database of sites
  mysql_db:
    name: "{{ site_env.db_name }}"
    state: present
    login_host: "{{ site_env.db_host }}"
    login_user: "{{ mysql_root_user }}"
    login_password: "{{ <PASSWORD> }}"
  with_dict: "{{ craft_sites }}"
  when: site_uses_local_db and item.value.db_create | default(True)

- name: Create/assign database user to db and grant permissions
  mysql_user:
    name: "{{ site_env.db_user }}"
    password: "{{ site_env.db_password }}"
    host: "{{ site_env.db_user_host }}"
    append_privs: no
    priv: "{{ site_env.db_name }}.*:SELECT,INSERT,DELETE,UPDATE,CREATE,ALTER,INDEX,DROP,REFERENCES"
    state: present
    login_host: "{{ site_env.db_host }}"
    login_user: "{{ mysql_root_user }}"
    login_password: "{{ <PASSWORD> }}"
  with_dict: "{{ craft_sites }}"
  when: site_uses_local_db and item.value.db_create | default(True)

- name: Copy database dump
  copy:
    src: "{{ item.value.db_import }}"
    dest: /tmp
  with_dict: "{{ craft_sites }}"
  when: item.value.db_import | default(False)

- name: Import database
  mysql_db:
    name: "{{ site_env.db_name }}"
    state: import
    target: "/tmp/{{ item.value.db_import | basename }}"
{'fraction_non_alphanumeric': 0.1550515463917526, 'fraction_numerical': 0.0, 'mean_word_length': 3.7106796116504857, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3814596', 'n_tokens_mistral': 883, 'n_tokens_neox': 874, 'n_words': 178}