<commit_before>---
- hosts: localhost
  gather_facts: no
  vars_files:
  - /root/default_vars.yml
  - /root/{{ g_oso_host_type }}_default_vars.yml
  vars:
    g_oso_cluster_id: "{{ lookup('env', 'OSO_CLUSTER_ID') }}"
    g_oso_host_type: "{{ lookup('env', 'OSO_HOST_TYPE') }}"

    g_zagg_client_config:
      host:
        name: "{{ lookup('env', 'ZAGG_CLIENT_HOSTNAME') | default(g_default_zagg_client_hostname, True) }}"
      zagg:
        url: "{{ lookup('env', 'ZAGG_URL') | default(g_default_zagg_url, True) }}"
        user: "{{ lookup('env', 'ZAGG_USER') | default(g_default_zagg_user, True) }}"
        pass: "{{ lookup('env', 'ZAGG_PASSWORD') | default(g_default_zagg_pass, True) }}"
        ssl_verify: "{{ lookup('env', 'ZAGG_SSL_VERIFY') | default(g_default_zagg_ssl_verify, True) }}"
        verbose: "{{ lookup('env', 'ZAGG_VERBOSE') | default(g_default_zagg_verbose, True) }}"
      pcp:
        metrics: "{{ g_default_pcp_metrics }}"
      heartbeat:
        templates: "{{ g_default_templates }}"
        hostgroups: "{{ [g_oso_cluster_id] | union(g_default_hostgroups) }}"


    g_zagg_client_cron:
    - name: run pcp checks every 5 minutes
      minute: "*/5"
      job: ops-runner -n ozc.send.pcp /usr/bin/ops-zagg-client --send-pcp
    - name: run pcp sampler every 5 minutes
      minute: "*/5"
      job: ops-runner -n cspsm.kernal.all.cpu /usr/bin/cron-send-pcp-sampled-metrics -m kernel.all.cpu.idle -m kernel.all.cpu.nice -m kernel.all.cpu.steal -m kernel.all.cpu.sys -m kernel.all.cpu.user -m kernel.all.cpu.wait.total -m kernel.all.cpu.irq.hard -m kernel.all.cpu.irq.soft

    - name: Do a full heartbeat
      minute: "10"
      hour: "*"
      job: ops-runner -n ozc.send.heartbeat.full /usr/bin/ops-zagg-client --send-heartbeat
    - name: Do a quick heartbeat
      minute: "*/5"
      job: ops-runner -n ozc.send.heartbeat.quick /usr/bin/ops-zagg-client -k heartbeat.ping -o 1
    - name: run filesystem space checks every 30 minutes
      minute: "*/30"
      job: ops-runner -n csfm.filesys.full.old /usr/local/bin/cron-send-filesystem-metrics.sh
    - name: run filesystem space checks every 10 minutes
      minute: "*/10"
      job: ops-runner -n csfm.filesys.full /usr/bin/cron-send-filesystem-metrics
    - name: run docker storage space checks every 10 minutes
      minute: "*/10"
      job: ops-runner -n csdm.docker.storage /usr/local/bin/cron-send-docker-metrics.py
    - name: send openshift-node process count
      minute: "*/2"
      job: ops-runner -n cspc.openshift.node.process.count /usr/bin/cron-send-process-count '^/usr/bin/openshift start node' openshift.node.process.count

    g_zagg_client_master_crons:
    - name: run create app every 5 minutes
      minute: "*/5"
      job: ops-runner -n csca.create_app /usr/local/bin/cron-send-create-app.py
    - name: send openshift-master process count
      minute: "*/2"
      job: ops-runner -n cspc.openshift.master.process.count /usr/bin/cron-send-process-count '^/usr/bin/openshift start master' openshift.master.process.count
    - name: send openshift-master user count every 6 hours
      minute: "4"
      hour : "*/6"
      job: ops-runner -n openshift.master.user.count /usr/local/bin/cron-send-user-count 

  pre_tasks:
  - stat:
      path: /secrets/zagg_client_vars.yml
    register: g_zagg_client_vars

  - name: Load variables that will override the defaults
    include_vars: /secrets/zagg_client_vars.yml
    when: g_zagg_client_vars.stat.exists

  - fail: msg="This playbook requires {{ item }} to be set and not empty."
    when: "{{ item }} is not defined or not {{ item }}"
    with_items:
    - g_zagg_client_config
    - g_oso_host_type
    - g_oso_cluster_id

  - debug: var=g_zagg_client_config

  - name: Generate the zagg_client.yaml config file
    copy:
      content: "{{ g_zagg_client_config | to_nice_yaml }}"
      dest: /etc/openshift_tools/zagg_client.yaml
      mode: "644"

  - name: Setup Cron
    cron:
      name: "{{ item.name }}"
      job: "{{ item.job }}"
      minute: "{{ item.minute | default('*', True) }}"
      hour: "{{ item.hour | default('*', True) }}"
      day: "{{ item.day | default('*', True) }}"
      month: "{{ item.month | default('*', True) }}"
      weekday: "{{ item.weekday | default('*', True) }}"
    with_items: g_zagg_client_cron

  - name: Setup Master Crons
    cron:
      name: "{{ item.name }}"
      job: "{{ item.job }}"
      minute: "{{ item.minute | default('*', True) }}"
      hour: "{{ item.hour | default('*', True) }}"
      day: "{{ item.day | default('*', True) }}"
      month: "{{ item.month | default('*', True) }}"
      weekday: "{{ item.weekday | default('*', True) }}"
    with_items: g_zagg_client_master_crons
    when: g_oso_host_type == 'master'
<commit_msg>Adding csuc to the ops runner part<commit_after>---
- hosts: localhost
  gather_facts: no
  vars_files:
  - /root/default_vars.yml
  - /root/{{ g_oso_host_type }}_default_vars.yml
  vars:
    g_oso_cluster_id: "{{ lookup('env', 'OSO_CLUSTER_ID') }}"
    g_oso_host_type: "{{ lookup('env', 'OSO_HOST_TYPE') }}"

    g_zagg_client_config:
      host:
        name: "{{ lookup('env', 'ZAGG_CLIENT_HOSTNAME') | default(g_default_zagg_client_hostname, True) }}"
      zagg:
        url: "{{ lookup('env', 'ZAGG_URL') | default(g_default_zagg_url, True) }}"
        user: "{{ lookup('env', 'ZAGG_USER') | default(g_default_zagg_user, True) }}"
        pass: "{{ lookup('env', 'ZAGG_PASSWORD') | default(g_default_zagg_pass, True) }}"
        ssl_verify: "{{ lookup('env', 'ZAGG_SSL_VERIFY') | default(g_default_zagg_ssl_verify, True) }}"
        verbose: "{{ lookup('env', 'ZAGG_VERBOSE') | default(g_default_zagg_verbose, True) }}"
      pcp:
        metrics: "{{ g_default_pcp_metrics }}"
      heartbeat:
        templates: "{{ g_default_templates }}"
        hostgroups: "{{ [g_oso_cluster_id] | union(g_default_hostgroups) }}"


    g_zagg_client_cron:
    - name: run pcp checks every 5 minutes
      minute: "*/5"
      job: ops-runner -n ozc.send.pcp /usr/bin/ops-zagg-client --send-pcp
    - name: run pcp sampler every 5 minutes
      minute: "*/5"
      job: ops-runner -n cspsm.kernal.all.cpu /usr/bin/cron-send-pcp-sampled-metrics -m kernel.all.cpu.idle -m kernel.all.cpu.nice -m kernel.all.cpu.steal -m kernel.all.cpu.sys -m kernel.all.cpu.user -m kernel.all.cpu.wait.total -m kernel.all.cpu.irq.hard -m kernel.all.cpu.irq.soft

    - name: Do a full heartbeat
      minute: "10"
      hour: "*"
      job: ops-runner -n ozc.send.heartbeat.full /usr/bin/ops-zagg-client --send-heartbeat
    - name: Do a quick heartbeat
      minute: "*/5"
      job: ops-runner -n ozc.send.heartbeat.quick /usr/bin/ops-zagg-client -k heartbeat.ping -o 1
    - name: run filesystem space checks every 30 minutes
      minute: "*/30"
      job: ops-runner -n csfm.filesys.full.old /usr/local/bin/cron-send-filesystem-metrics.sh
    - name: run filesystem space checks every 10 minutes
      minute: "*/10"
      job: ops-runner -n csfm.filesys.full /usr/bin/cron-send-filesystem-metrics
    - name: run docker storage space checks every 10 minutes
      minute: "*/10"
      job: ops-runner -n csdm.docker.storage /usr/local/bin/cron-send-docker-metrics.py
    - name: send openshift-node process count
      minute: "*/2"
      job: ops-runner -n cspc.openshift.node.process.count /usr/bin/cron-send-process-count '^/usr/bin/openshift start node' openshift.node.process.count

    g_zagg_client_master_crons:
    - name: run create app every 5 minutes
      minute: "*/5"
      job: ops-runner -n csca.create_app /usr/local/bin/cron-send-create-app.py
    - name: send openshift-master process count
      minute: "*/2"
      job: ops-runner -n cspc.openshift.master.process.count /usr/bin/cron-send-process-count '^/usr/bin/openshift start master' openshift.master.process.count
    - name: send openshift-master user count every 6 hours
      minute: "4"
      hour : "*/6"
      job: ops-runner -n csuc.openshift.master.user.count /usr/local/bin/cron-send-user-count 

  pre_tasks:
  - stat:
      path: /secrets/zagg_client_vars.yml
    register: g_zagg_client_vars

  - name: Load variables that will override the defaults
    include_vars: /secrets/zagg_client_vars.yml
    when: g_zagg_client_vars.stat.exists

  - fail: msg="This playbook requires {{ item }} to be set and not empty."
    when: "{{ item }} is not defined or not {{ item }}"
    with_items:
    - g_zagg_client_config
    - g_oso_host_type
    - g_oso_cluster_id

  - debug: var=g_zagg_client_config

  - name: Generate the zagg_client.yaml config file
    copy:
      content: "{{ g_zagg_client_config | to_nice_yaml }}"
      dest: /etc/openshift_tools/zagg_client.yaml
      mode: "644"

  - name: Setup Cron
    cron:
      name: "{{ item.name }}"
      job: "{{ item.job }}"
      minute: "{{ item.minute | default('*', True) }}"
      hour: "{{ item.hour | default('*', True) }}"
      day: "{{ item.day | default('*', True) }}"
      month: "{{ item.month | default('*', True) }}"
      weekday: "{{ item.weekday | default('*', True) }}"
    with_items: g_zagg_client_cron

  - name: Setup Master Crons
    cron:
      name: "{{ item.name }}"
      job: "{{ item.job }}"
      minute: "{{ item.minute | default('*', True) }}"
      hour: "{{ item.hour | default('*', True) }}"
      day: "{{ item.day | default('*', True) }}"
      month: "{{ item.month | default('*', True) }}"
      weekday: "{{ item.weekday | default('*', True) }}"
    with_items: g_zagg_client_master_crons
    when: g_oso_host_type == 'master'

{'fraction_non_alphanumeric': 0.15358040201005024, 'fraction_numerical': 0.00628140703517588, 'mean_word_length': 2.8738848337388485, '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': '6429414', 'n_tokens_mistral': 3548, 'n_tokens_neox': 3430, 'n_words': 738}