Sysctl

17 views
Skip to first unread message

Vino B

unread,
Mar 13, 2018, 4:48:19 AM3/13/18
to Ansible Project
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

Vino B

unread,
Mar 13, 2018, 12:52:58 PM3/13/18
to Ansible Project
Hi All,

Any help is much appreciated.

Jean-Yves LENHOF

unread,
Mar 13, 2018, 1:06:45 PM3/13/18
to ansible...@googlegroups.com

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,

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9960a0ec-e63b-4aa4-8c38-40275b393b34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vino B

unread,
Mar 14, 2018, 1:23:33 AM3/14/18
to Ansible Project
Hi Jeans,

  Thank you very much.
Reply all
Reply to author
Forward
0 new messages