--- - hosts: Controller vars: metadata: name: Check controller ulimits description: > This will check the ulimits of each controller. groups: - post-deployment nofiles_min: 1024 nproc_min: 2048 tasks: - name: Get nofiles limit become: true # NOTE: `ulimit` is a shell builtin so we have to invoke it like this: command: sh -c "ulimit -n" register: nofilesval changed_when: False - name: Check nofiles limit fail: msg: > nofiles is set to {{ nofilesval.stdout }}. It should be at least {{ nofiles_min }} or higher, depending on available resources. failed_when: "nofilesval.stdout|int < nofiles_min" - name: Get nproc limit become: true # NOTE: `ulimit` is a shell builtin so we have to invoke it like this: command: sh -c "ulimit -u" register: nprocval changed_when: False - name: Check nproc limit fail: msg: > nproc is set to {{ nprocval.stdout }}. It should be at least {{ nproc_min }} or higher, depending on available resources. failed_when: "nprocval.stdout|int < nproc_min"