<commit_before>- include: ../../common/tasks/setfacts.yml
  tags:
    - logger-service
    - properties

- name: create logger DB
  mysql_db: name={{logger_db_name}} state=present encoding=utf8
  register: dbschema
  tags:
    - logger-service
    - db

- name: create logger DB user
  mysql_user: name={{logger_db_username}} password={{logger_<PASSWORD>}} priv=*.*:ALL state=present
  register: dbuser
  tags:
    - logger-service
    - db

- name: copy transient files to tmp (schemas etc)
  copy: src={{item}} dest=/tmp
  with_items:
    - db/
  when: dbschema.changed
  tags:
    - logger-service
    - db

- name: create schema, stored procs and reference data
  mysql_db: name={{logger_db_name}} state=import target={{item}}
  with_items:
    - /tmp/schema.sql
    - /tmp/eventLogType.sql
    - /tmp/reasonLogType.sql
    - /tmp/sourceLogType.sql
    - /tmp/refresh_summary_breakdown_email.sql
    - /tmp/refresh_summary_breakdown_reason.sql
    - /tmp/refresh_summary_breakdown_source.sql
    - /tmp/refresh_summary_totals.sql
    - /tmp/update_breakdown_summary_information.sql
# The following is broken on MySQL-8.0, reenable if it becomes an issue in future
#    - /tmp/definer_user.sql
  when: dbschema.changed
  tags:
    - logger-service
    - db

- name: ensure target directories exist [data subdirectories etc.]
  file: path={{item}} state=directory owner={{tomcat_user}} group={{tomcat_user}}
  with_items:
    - "{{data_dir}}/logger/config"
  tags:
    - logger-service
    - properties

- name: copy all config.properties
  template: src=logger-config.properties dest={{data_dir}}/logger/config/logger-config.properties output_encoding=iso-8859-1
  tags:
    - logger-service
    - properties

- name: set data ownership
  file: path={{data_dir}}/logger owner={{tomcat_user}} group={{tomcat_user}} recurse=true
  notify: 
    - restart tomcat
  tags:
    - logger-service
    - properties

- include: ../../apache_vhost/tasks/main.yml context_path='{{ logger_context_path }}' hostname='{{ logger_hostname }}'
  tags:
    - logger-service
    - deploy
    - apache_vhost
  when: not webserver_nginx

- name: copy all SQL auth ip scripts
  template: src={{ item }} dest={{data_dir}}/logger/setup/
  with_items:
    - "sql/auth-ip.sql"
  when: logger_authorize_ip_list is defined
  tags:
    - logger-service
    - test
    - db
    - properties

- name: create auth ip in db if does not exists
  shell: "mysql --host={{ logger_db_hostname }} --user={{ logger_db_username }} --password={{ <PASSWORD> }} {{ logger_db_name }} -e \"set @ip='{{ item }}'; set @host_name='{{ item }}'; source {{data_dir}}/logger/setup/auth-ip.sql;\""
  loop: "{{ (logger_authorize_ip_list | regex_replace(' ', '')).split(',') }}"
  when: logger_authorize_ip_list is defined
  ignore_errors: no
  tags:
    - logger-service
    - test
    - db

- name: set nginx proxy target if configured
  set_fact:
    logger_proxy_target: "{{logger_context_path}}"
  tags:
    - nginx_vhost
    - deploy
    - logger-service
  when: webserver_nginx and logger_proxy_target is not defined

- name: add nginx vhost if configured
  include_role:
    name: nginx_vhost
  vars:
    appname: "logger-service"
    hostname: "{{ logger_hostname }}"
    context_path: "{{ logger_context_path }}"<commit_msg>Remove testing tag<commit_after>- include: ../../common/tasks/setfacts.yml
  tags:
    - logger-service
    - properties

- name: create logger DB
  mysql_db: name={{logger_db_name}} state=present encoding=utf8
  register: dbschema
  tags:
    - logger-service
    - db

- name: create logger DB user
  mysql_user: name={{logger_db_username}} password={{<PASSWORD>}} priv=*.*:ALL state=present
  register: dbuser
  tags:
    - logger-service
    - db

- name: copy transient files to tmp (schemas etc)
  copy: src={{item}} dest=/tmp
  with_items:
    - db/
  when: dbschema.changed
  tags:
    - logger-service
    - db

- name: create schema, stored procs and reference data
  mysql_db: name={{logger_db_name}} state=import target={{item}}
  with_items:
    - /tmp/schema.sql
    - /tmp/eventLogType.sql
    - /tmp/reasonLogType.sql
    - /tmp/sourceLogType.sql
    - /tmp/refresh_summary_breakdown_email.sql
    - /tmp/refresh_summary_breakdown_reason.sql
    - /tmp/refresh_summary_breakdown_source.sql
    - /tmp/refresh_summary_totals.sql
    - /tmp/update_breakdown_summary_information.sql
# The following is broken on MySQL-8.0, reenable if it becomes an issue in future
#    - /tmp/definer_user.sql
  when: dbschema.changed
  tags:
    - logger-service
    - db

- name: ensure target directories exist [data subdirectories etc.]
  file: path={{item}} state=directory owner={{tomcat_user}} group={{tomcat_user}}
  with_items:
    - "{{data_dir}}/logger/config"
  tags:
    - logger-service
    - properties

- name: copy all config.properties
  template: src=logger-config.properties dest={{data_dir}}/logger/config/logger-config.properties output_encoding=iso-8859-1
  tags:
    - logger-service
    - properties

- name: set data ownership
  file: path={{data_dir}}/logger owner={{tomcat_user}} group={{tomcat_user}} recurse=true
  notify: 
    - restart tomcat
  tags:
    - logger-service
    - properties

- include: ../../apache_vhost/tasks/main.yml context_path='{{ logger_context_path }}' hostname='{{ logger_hostname }}'
  tags:
    - logger-service
    - deploy
    - apache_vhost
  when: not webserver_nginx

- name: copy all SQL auth ip scripts
  template: src={{ item }} dest={{data_dir}}/logger/setup/
  with_items:
    - "sql/auth-ip.sql"
  when: logger_authorize_ip_list is defined
  tags:
    - logger-service
    - db
    - properties

- name: create auth ip in db if does not exists
  shell: "mysql --host={{ logger_db_hostname }} --user={{ logger_db_username }} --password={{ logger_db_password }} {{ logger_db_name }} -e \"set @ip='{{ item }}'; set @host_name='{{ item }}'; source {{data_dir}}/logger/setup/auth-ip.sql;\""
  loop: "{{ (logger_authorize_ip_list | regex_replace(' ', '')).split(',') }}"
  when: logger_authorize_ip_list is defined
  ignore_errors: no
  tags:
    - logger-service
    - db

- name: set nginx proxy target if configured
  set_fact:
    logger_proxy_target: "{{logger_context_path}}"
  tags:
    - nginx_vhost
    - deploy
    - logger-service
  when: webserver_nginx and logger_proxy_target is not defined

- name: add nginx vhost if configured
  include_role:
    name: nginx_vhost
  vars:
    appname: "logger-service"
    hostname: "{{ logger_hostname }}"
    context_path: "{{ logger_context_path }}"
{'fraction_non_alphanumeric': 0.1302354020177316, 'fraction_numerical': 0.0024457352491592784, 'mean_word_length': 3.2961260669730796, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5889562', 'n_tokens_mistral': 2180, 'n_tokens_neox': 2165, 'n_words': 504}