Skip to content
Snippets Groups Projects
main.yml 3.41 KiB
Newer Older
- name: Install Telegraf from URL [RHEL/CentOS]
  yum:
    name: "{{ telegraf_install_rpm_url }}"
Kerri Wait's avatar
Kerri Wait committed
    state: latest
  when: ansible_os_family == "RedHat"
  become: true
  become_user: root

- name: Download Telegraf package via URL [Debian/Ubuntu]
  get_url:
    url: "{{ telegraf_install_deb_url }}"
    dest: /tmp/telegraf-ansible-download.deb
  when: ansible_os_family == "Debian"
  become: true
  become_user: root

- name: Install Telegraf package
  apt:
    deb: /tmp/telegraf-ansible-download.deb
    state: present
  when: ansible_os_family == "Debian"
  become: true
  become_user: root

Andreas Hamacher's avatar
Andreas Hamacher committed
- name: "register if a mellanox card is present"
  shell: "lspci | grep Mellanox"
  ignore_errors: true
  register: mellanoxcard
  check_mode: no

- name: Get list of hardware counters for interfaces
  script: files/hw_counters.py
  register: hwcounters
Andreas Hamacher's avatar
Andreas Hamacher committed
  when: not mellanoxcard.failed
- name: Set hardware counters in facts
  set_fact:
    hwcounterlist: "{{ hwcounters.stdout | from_json }}"
Andreas Hamacher's avatar
Andreas Hamacher committed
  when: not mellanoxcard.failed
- name: Make a directory for extra files
    state: directory
    mode: 'u=rwx,g=rx,o=rx'
    owner: 'telegraf'
    group: 'telegraf'
    path: '/opt/telegraf/bin'
  become: true
  become_user: root

- name: copy mountstats plugin
  copy:
    mode: 'u=rwx,g=rx,o=rx'
    src: telegraf_mountstats.py
    dest: '/opt/telegraf/bin/telegraf_mountstats.py'
  become: true
  become_user: root

- name: copy slurmstats plugin
  copy:
    mode: 'u=rwx,g=rx,o=rx'
    src: telegraf_slurmstats.py
    dest: '/opt/telegraf/bin/telegraf_slurmstats.py'
  become: true
  become_user: root

- name: copy softnet_stat script
  copy:
    mode: 'u=rw,g=r,o=r'
    src: telegraf_softnet_stats.awk
    dest: '/opt/telegraf/bin/telegraf_softnet_stats.awk'
  become: true
  become_user: root

- name: Install Telegraf config
  template:
    src: telegraf.conf.j2
    dest: /etc/telegraf/telegraf.conf
    owner: telegraf
    group: telegraf
    mode: '640'
  notify:
    - "restart telegraf"
  become: true
  become_user: root
Kerri Wait's avatar
Kerri Wait committed
  tags:
    - configuration
- name: Install ethtool plugin for mlx interfaces
  template:
    src: inputs.ethtool.conf.j2
    dest: /etc/telegraf/telegraf.d/inputs.ethtool.conf
    owner: telegraf
    group: telegraf
    mode: '640'
  notify:
    - "restart telegraf"
  become: true
  become_user: root
  tags:
    - configuration

# Commented out by KW 13th Oct 2020 - will restore shortly
#- name: Install filecount plugin for /home counts
#  template:
#    src: inputs.filecount.conf.j2
#    dest: /etc/telegraf/telegraf.d/inputs.filecount.conf
#    owner: telegraf
#    group: telegraf
#    mode: '640'
#  notify:
#    - "restart telegraf"
#  become: true
#  become_user: root
#  tags:
#    - configuration

- name: Install multifile plugin for mlx hw_counters
  template:
    src: inputs.multifile_mlx.conf.j2
    dest: /etc/telegraf/telegraf.d/inputs.multifile_mlx.conf
    owner: telegraf
    group: telegraf
    mode: '640'
  notify:
    - "restart telegraf"
  become: true
  become_user: root
  tags:
    - configuration
Andreas Hamacher's avatar
Andreas Hamacher committed
  when: not mellanoxcard.failed
- name: Install nvidia-smi plugin
  template:
    src: inputs.nvidia_smi.conf.j2
    dest: /etc/telegraf/telegraf.d/inputs.nvidia_smi.conf
    owner: telegraf
    group: telegraf
    mode: '640'
  notify:
    - "restart telegraf"
  become: true
  become_user: root
  tags:
    - configuration
  when: "'VisNodes' in group_names or 'DGXRHELNodes' in group_names"