<commit_before>---
- name: OS-specific variables
  include_vars: "{{ ansible_os_family }}.yml"

- name: Include collector definitions
  include_vars: "collector_definitions.yml"

- name: Check if diamond is installed
  stat: path=/etc/diamond/diamond.conf
  register: checkdiamondconffile

- name: Check if diamond is running
  shell: pgrep diamond
  register: checkdiamondprocess
  ignore_errors: true

# Install prebuilt diamond on Debian
- include: setup-Debian-bin.yml
  when: ansible_os_family == 'Debian' and build_from_source == false

# Build Diamond from source
- include: setup-Debian-source.yml
  when: ansible_os_family == 'Debian' and build_from_source == true and not checkdiamondconffile.stat.exists and checkdiamondprocess|failed

# Build Diamond from source
- include: setup-RedHat-source.yml
  when: ansible_os_family == 'RedHat' and build_from_source == true and not checkdiamondconffile.stat.exists and checkdiamondprocess|failed

# Common for both OS's

- name: Update diamond.conf with latest template content
  template: src=diamond.conf dest="{{diamond_conf_basepath}}" backup=yes
  register: diamondconffilestate

- name: Configuring collector {{item.key}}
  template: src=diamondcollectorconf.j2 dest="{{collector_conf_path}}/{{item.key}}.conf"
  with_dict: diamond_collector_default_defs
  when: "item.key not in diamond_collector_extra_defs.keys()"
  register: defaultdiamondcollectorsstate

- name: Configuring collector {{item.key}}
  template: src=diamondcollectorconf.j2 dest="{{collector_conf_path}}/{{item.key}}.conf"
  with_dict: diamond_collector_extra_defs
  register: extradiamondcollectorsstate

- name: Restart diamond if config has changed
  service: name=diamond state=restarted
  when: defaultdiamondcollectorsstate.changed or extradiamondcollectorsstate.changed or diamondconffilestate.changed or checkdiamondprocess|failed<commit_msg>Full path for config - needed by Ansible 1.8.3<commit_after>---
- name: OS-specific variables
  include_vars: "{{ ansible_os_family }}.yml"

- name: Include collector definitions
  include_vars: "collector_definitions.yml"

- name: Check if diamond is installed
  stat: path=/etc/diamond/diamond.conf
  register: checkdiamondconffile

- name: Check if diamond is running
  shell: pgrep diamond
  register: checkdiamondprocess
  ignore_errors: true

# Install prebuilt diamond on Debian
- include: setup-Debian-bin.yml
  when: ansible_os_family == 'Debian' and build_from_source == false

# Build Diamond from source
- include: setup-Debian-source.yml
  when: ansible_os_family == 'Debian' and build_from_source == true and not checkdiamondconffile.stat.exists and checkdiamondprocess|failed

# Build Diamond from source
- include: setup-RedHat-source.yml
  when: ansible_os_family == 'RedHat' and build_from_source == true and not checkdiamondconffile.stat.exists and checkdiamondprocess|failed

# Common for both OS's

- name: Update diamond.conf with latest template content
  template: src=diamond.conf dest="{{diamond_conf_basepath}}/diamond.conf" backup=yes
  register: diamondconffilestate

- name: Configuring collector {{item.key}}
  template: src=diamondcollectorconf.j2 dest="{{collector_conf_path}}/{{item.key}}.conf"
  with_dict: diamond_collector_default_defs
  when: "item.key not in diamond_collector_extra_defs.keys()"
  register: defaultdiamondcollectorsstate

- name: Configuring collector {{item.key}}
  template: src=diamondcollectorconf.j2 dest="{{collector_conf_path}}/{{item.key}}.conf"
  with_dict: diamond_collector_extra_defs
  register: extradiamondcollectorsstate

- name: Restart diamond if config has changed
  service: name=diamond state=restarted
  when: defaultdiamondcollectorsstate.changed or extradiamondcollectorsstate.changed or diamondconffilestate.changed or checkdiamondprocess|failed
{'fraction_non_alphanumeric': 0.08964248159831756, 'fraction_numerical': 0.001840168243953733, 'mean_word_length': 5.868231046931408, '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': '1301985', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1120, 'n_words': 296}