---
- block:

  - name: Stop cgred
    service:
      name: cgred
      state: stopped
    ignore_errors: yes # service may have been deleted already

  - name: Remove cgred
    file:
      path: "/etc/init/cgred.conf"
      state: absent

  - name: Install CGroup files
    copy:
      src: "{{ item.src }}"
      dest: "{{ item.dest }}"
      owner: root
      group: root
      mode: '644'
    with_items:
      - { src: "cgconfig.conf", dest: "/etc/init/cgconfig.conf" }

  - name: Restart cgconfig
    service:
      name: cgconfig
      state: restarted
  become: yes

