Sysctl

Hi All,

Request your help, on the below code, i wanted to check whether the sysctl paramater “vm.nr_hugepages” has any numeric value .

  • name: Check whether System Settings are Optimized
    command: sysctl -n {{ item.pname }}
    register: net_param
    failed_when: net_param.stdout != item.value
    with_items:

  • { pname: ‘net.core.rmem_max’, value: “16777216” }

  • { pname: ‘vm.nr_hugepages’, value: ‘regex[0-9]’ } <==== Issue

changed_when: false
ignore_errors: True

From,
Vino.B

Hi All,

Any help is much appreciated.

Why reinventing the wheel, there’s already a function for this in jinja… numeric

http://jinja.pocoo.org/docs/2.9/templates/#number

You probably have to do two different steps… It depends exactly on what you want (perhaps not what you write)

Regards,

Hi Jeans,

Thank you very much.