---
- name: Install APT packages
  sudo: True
  apt:
    pkg: "{{ item }}"
    state: present
    update_cache: yes
    cache_valid_time: 3600
  with_items:
    - git
    - sysstat
    - nmon
    - iotop
    - bwm-ng

- name: Create directory for kvm metric collection configuration file
  file: path=/opt/telegraf state=directory mode=0755
  when: "'compute_hosts' in group_names"

- name: Set configuration file for kvm metric collection
  copy:
    src: "files/{{ item }}"
    dest: "/opt/telegraf/{{ item }}"
    mode: 0755
  with_items:
    - kvm_virsh.py
  when: "'compute_hosts' in group_names"

- name: Install perf-tools from git
  git:
    repo: "{{ perf_tools_git_repo }}"
    dest: "{{ perf_tools_git_dest }}"
    version: "{{ perf_tools_git_install_branch }}"
  when: misc-perftools-install-tracing-tools

---
- name: Install APT packages
  sudo: True
  apt:
    pkg: "{{ item }}"
    state: present
    update_cache: yes
    cache_valid_time: 3600
  with_items:
    - git
    - sysstat
    - nmon
    - iotop
    - bwm-ng

- name: Create directory for kvm metric collection configuration file
  file: path=/opt/telegraf state=directory mode=0755
  when: "'compute_hosts' in group_names"

- name: Set configuration file for kvm metric collection
  copy:
    src: "files/{{ item }}"
    dest: "/opt/telegraf/{{ item }}"
    owner: "telegraf"
    group: "telegraf"
    mode: 0755
  with_items:
    - kvm_virsh.py
  when: "'compute_hosts' in group_names"

- name: Install perf-tools from git
  git:
    repo: "{{ perf_tools_git_repo }}"
    dest: "{{ perf_tools_git_dest }}"
    version: "{{ perf_tools_git_install_branch }}"
  when: misc-perftools-install-tracing-tools

Add owner and group for file copy
tasks: Add owner and group for file copy

As request in PR#4.
