---
- name: Fix cgroup permissions for Nomad
  hosts: germany
  become: yes
  tasks:
    - name: Recursively change ownership of nomad cgroup directory
      file:
        path: /sys/fs/cgroup/cpuset/nomad
        state: directory
        owner: root
        group: root
        recurse: yes

    - name: Change ownership of the parent cpuset directory
      file:
        path: /sys/fs/cgroup/cpuset/
        state: directory
        owner: root
        group: root