Validation to check ulimits on controller

Change-Id: If653cc97e28c84a55c214eb6d2580b0b7e48acbc
Co-Authored-By: John Browning <jecbrowning@gmail.com>
This commit is contained in:
Tomas Sedovic 2016-08-11 11:53:32 +02:00
parent 7456102348
commit 37585b1686
1 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,38 @@
---
- hosts: controller
vars:
metadata:
name: Check controller ulimits
description: >
This will check the ulimits of each controller.
groups:
- post-deployment
nofiles_min: 2048
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 }}"