---
# file: roles/sonarqube/defaults/main.yml

sonarqube_update_sonarqube_now: false
sonarqube_ldap: true
sonarqube_haproxy: true

sonarqube_download_url: "https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-{{ sonarqube_version }}.zip"

sonarqube_postgres_password: "{{ lookup('hashi_vault', 'secret=talas-kv/data/' + host_vars_location + '/' + ansible_hostname)['sonarqube_postgres_password'] }}"

sonarqube_ce_jmx_config: >-
  -Dcom.sun.management.jmxremote=true
  -Djava.rmi.server.hostname={{ ansible_host }}
  -Dcom.sun.management.jmxremote.port=12345
  -Dcom.sun.management.jmxremote.rmi.port=12345
  -Dcom.sun.management.jmxremote.ssl=false
  -Dcom.sun.management.jmxremote.authenticate=true
  -Dcom.sun.management.jmxremote.password.file=/opt/sonarqube/stateless/conf/jmxremote.password
  -Dcom.sun.management.jmxremote.access.file=/opt/sonarqube/stateless/conf/jmxremote.access
sonarqube_web_jmx_config: >-
  -Dcom.sun.management.jmxremote=true
  -Djava.rmi.server.hostname={{ ansible_host }}
  -Dcom.sun.management.jmxremote.port=12346
  -Dcom.sun.management.jmxremote.rmi.port=12346
  -Dcom.sun.management.jmxremote.ssl=false
  -Dcom.sun.management.jmxremote.authenticate=true
  -Dcom.sun.management.jmxremote.password.file=/opt/sonarqube/stateless/conf/jmxremote.password
  -Dcom.sun.management.jmxremote.access.file=/opt/sonarqube/stateless/conf/jmxremote.access

sonarqube_jmx_user_list:
  - name: "monitoring"
    right: "readonly"
    password: "{{ lookup('hashi_vault', 'secret=talas-kv/data/group_vars/all')['zabbix_jmx_monitoring_password'] }}"
  - name: "operator"
    right: "readwrite"
    password: "{{ lookup('hashi_vault', 'secret=talas-kv/data/services/veza')['tomcat_jmx_operator'] }}"

pg_users:
  - name: "sonarqube"
    attrib: LOGIN
    password: "{{ sonarqube_postgres_password }}"

pg_databases:
  - name: sonarqube
    owner: sonarqube

java_home: "/opt/{{ jvm_latest_17_directory_name }}"
jvm_url_list:
  - "https://internal-resources-1.talas.com/openjdk/{{ jvm_latest_17_archive_name }}"

haproxy_frontend:
  default_backend: "sonarqube"

haproxy_backend:
  - name: "sonarqube"
    server:
      - name: "myself"
        fqdn: "127.0.0.1"
        port: "9000"

haproxy_timeout_client: "20m"
haproxy_timeout_server: "20m"

haproxy_https_monitoring:
  - "{{ sonarqube_url }}"
