Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

0

Regular Expression
Python

r"
^(GRUB_CMDLINE_LINUX_DEFAULT=(?!.*elevator=noop).*)\"
"
gm

Description

  • name: OPITMIZ | GRUB | Set DISK Scheduler a elevator=noop lineinfile: dest: /etc/default/grub regexp: '^(GRUB_CMDLINE_LINUX_DEFAULT=(?!.elevator=noop).)"' line: '\1 elevator=noop"' backrefs: yes register: shceduler notify: update-grub tags: optimization,disk,scheduler,test

  • name: OPITMIZ | VERIF | Get list of block devices to test shell: ls /sys/block/ | egrep '^([shv]|xv])d[a-z]$' register: block_devs changed_when: no tags: optimization,disk,scheduler,test

  • name: OPITMIZ | VERIF | Test if block device using noop i/o scheduler shell: cat /sys/block/{{ item }}/queue/scheduler with_items: '{{ block_devs.stdout }}' register: noop_test tags: optimization,disk,scheduler,test

  • name: OPITMIZ | VERIF | Check eleavtor status debug: var=noop_test.results[0].stdout tags: optimization,disk,scheduler,test

Submitted by Pintax - 8 years ago