---

- block:
  - name: create grub.d directory
    file:
      name: /etc/default/grub.d
      state: directory
      owner: root
      group: root
      mode: "0755"

  - name: configure kernel parameters in grub
    copy:
      src: zoox-cgroups.cfg
      dest: /etc/default/grub.d/zoox-cgroups.cfg
      owner: root
      group: root
      mode: "0644"
    notify: update grub

  - name: install cgroup config upstart script
    copy:
      src: zoox-cgroups-config.conf
      dest: /etc/init/zoox-cgroups-config.conf
      owner: root
      group: root
      mode: "0644"

  - name: start the cgroup config service
    service:
      name: zoox-cgroups-config
      state: started
    changed_when: false # will always show as 'changed' which isn't useful

  become: yes
  when: ansible_distribution_version == '14.04'
