---
- block:
  - name: install sysstat package
    package:
      name: sysstat
      state: installed

  - name: enable sysstat service
    service:
      name: sysstat
      enabled: yes
  when: ansible_system == "Linux"

---
- block:
  - name: install sysstat package
    package:
      name: sysstat
      state: installed

  - name: enable power statistics
    lineinfile:
      path: /etc/sysconfig/sysstat
      regexp: '^SADC_OPTIONS='
      line: 'SADC_OPTIONS="-S DISK -S POWER"'
    when: ansible_virtualization_role != "guest"

  - name: enable sysstat service
    service:
      name: sysstat
      enabled: yes
  when: ansible_system == "Linux"

Enable power statistics on physical hosts
sysstat: Enable power statistics on physical hosts
