---
- block:
  - name: Enable realtime priority scheduling
    pam_limits:
      domain: zoox
      limit_item: rtprio
      value: unlimited
      limit_type: "{{ item }}"
    with_items:
      - hard
      - soft

  - name: Disable ubuntu ntpdate
    file:
      name: /etc/network/if-up.d/ntpdate
      state: absent

  - name: Disable CPU ubuntu power-save states
    service:
      name: ondemand
      enabled: no
    when: "os_release_name == 'trusty'"

  - name: Install cpufrequtils
    apt:
      name: cpufrequtils
      install_recommends: no
      cache_valid_time: "{{ apt_cache_valid_time }}"

  - name: Set default CPU speed governor
    copy:
      dest: /etc/default/cpufrequtils
      content: "GOVERNOR=\"performance\"\n"
    notify: Restart cpufrequtils

  - name: Disable Ubuntu LTS upgrades
    copy:
      src: "release-upgrades"
      dest: "/etc/update-manager/release-upgrades"
      owner: root
      group: root
      mode: 0644

  become: yes
