regex - How to specify case insensitive mode in ansible lineinfile regexp? -
simple question. i'm trying match "usedns", "usedns" , other variations. - name: disable dns checking on login (huge speedup) sudo: true lineinfile: dest: "/etc/ssh/sshd_config" regexp: "^[# \t]*[uu][ss][ee][dd][nn][ss] " # how 1 specify case insensitive regexp in lineinfile? line: "usedns no" state: "present" create: true insertafter: eof notify: - sshd restart
ansible uses python re module. can use inline modifiers, such (?ism)
in pattern. use i case-insensitive matching:
regexp: "(?i)^[# \t]*usedns "
Comments
Post a Comment