MAJOR=189 MINOR=2 DEVNAME=bus/usb/001/003 DEVTYPE=usb_device DRIVER=usb PRODUCT=627/1/0 TYPE=0/0/0 BUSNUM=001 DEVNUM=003  ˆ¿Ä „/¶ÃÂÁ?÷ # -*- coding: utf-8 -*- # Copyright: (c) 2012, Daniel Hokka Zakrisson # Copyright: (c) 2014, Ahti Kitsik # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = r''' --- module: lineinfile short_description: Manage lines in text files description: - This module ensures a particular line is in a file, or replace an existing line using a back-referenced regular expression. - This is primarily useful when you want to change a single line in a file only. - See the M(ansible.builtin.replace) module if you want to change multiple, similar lines or check M(ansible.builtin.blockinfile) if you want to insert/update/remove a block of lines in a file. For other cases, see the M(ansible.builtin.copy) or M(ansible.builtin.template) modules. version_added: "0.7" options: path: description: - The file to modify. - Before Ansible 2.3 this option was only usable as I(dest), I(destfile) and I(name). type: path required: true aliases: [ dest, destfile, name ] regexp: description: - The regular expression to look for in every line of the file. - For C(state=present), the pattern to replace if found. Only the last line found will be replaced. - For C(state=absent), the pattern of the line(s) to remove. - If the regular expression is not matched, the line will be added to the file in keeping with C(insertbefore) or C(insertafter) settings. - When modifying a line the regexp should typically match both the initial state of the line as well as its state after replacement by C(line) to ensure idempotence. - Uses Python regular expressions. See U(https://docs.python.org/3/library/re.html). type: str aliases: [ regex ] version_added: '1.7' search_string: description: - The literal string to look for in every line of the file. This does not have to match the entire line. - For C(state=present), the line to replace if the string is found in the file. Only the last line found will be replaced. - For C(state=absent), the line(s) to remove if the string is in the line. - If the literal expression is not matched, the line will be added to the file in keeping with C(insertbefore) or C(insertafter) settings. - Mutually exclusive with C(backrefs) and C(regexp). type: str version_added: '2.11' state: description: - Whether the line should be there or not. type: str choices: [ absent, present ] default: present line: description: - The line to insert/replace into the file. - Required for C(state=present). - If C(backrefs) is set, may contain backreferences that will get expanded with the C(regexp) capture groups if the regexp matches. type: str aliases: [ value ] backrefs: description: - Used with C(state=present). - If set, C(line) can contain backreferences (both positional and named) that will get populated if the C(regexp) matches. - This parameter changes the operation of the module slightly; C(insertbefore) and C(insertafter) will be ignored, and if the C(regexp) does not match anywhere in the file, the file will be left unchanged. - If the C(regexp) does match, the last matching line will be replaced by the expanded line parameter. - Mutually exclusive with C(search_string). type: bool default: no version_added: "1.1" insertafter: description: - Used with C(state=present). - If specified, the line will be inserted after the last match of specified regular expression. - If the first match is required, use(firstmatch=yes). - A special valu