On Sunday, 11 March 2018 07.45.48 CET Vino B wrote: > > On Sunday, March 11, 2018 at 3:07:24 AM UTC+8, Kai Stian Olstad wrote: > > > > There are many ways to do that, here is one > > > > - slurp: > > src: /etc/default/grub > > register: r > > > > - debug: msg="Found it" > > when: r.content | b64decode | > > regex_search('^GRUB_CMDLINE_LINUX_DEFAULT=.*numa_balancing=disable') > > > > > > > > Thank you very much, but the above solution always states tune eve when > the search criteria is changed eg. in the above code if you change the > =disable" to ="disbaleX" it should fail, but the output states as successful > > when: r.content | b64decode | > regex_search('^GRUB_CMDLINE_LINUX_DEFAULT=.*numa_balancing=disableX')
I made a little test and can't confirm this $ cat grub GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/hda1 disk=/dev/hda resume=swap console=ttyS0,115200n8 multipath=off net.ifnames=0 NON_PERSISTENT_DEVICE_NAMES=1 quiet elevator=noop intel_idle.max_cstate=1 processor.max_cstate=1 numa_balancing=disable" cat test.yml --- - hosts: localhost tasks: - slurp: src: grub register: r - name: disable debug: msg="Found it" when: r.content | b64decode | regex_search('^GRUB_CMDLINE_LINUX_DEFAULT=.*numa_balancing=disable') - name: diableX debug: msg="Found it" when: r.content | b64decode | regex_search('^GRUB_CMDLINE_LINUX_DEFAULT=.*numa_balancing=disableX') Output: TASK [disable] ********************************** ok: [localhost] => {} MSG: Found it TASK [diableX] ********************************** skipping: [localhost] => { "changed": false, "skip_reason": "Conditional result was False" } -- Kai Stian Olstad -- 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-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/152081233.bdZeENrDx6%40x1. For more options, visit https://groups.google.com/d/optout.