ansible / ansible.builtin / v2.9.27 / module / patch Apply patch files using the GNU patch tool | "added in version" 1.9 of ansible.builtin" Authors: Jakub Jirutka (@jirutka), Luis Alberto Perez Lazaro (@luisperlaz) stableinterface | supported by communityansible.builtin.patch (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Apply patch files using the GNU patch tool.
- name: Apply patch to one file patch: src: /tmp/index.html.patch dest: /var/www/index.html
- name: Apply patch to multiple files under basedir patch: src: /tmp/customize.patch basedir: /var/www strip: 1
- name: Revert patch to one file patch: src: /tmp/index.html.patch dest: /var/www/index.html state: absent
src: aliases: - patchfile description: - Path of the patch file as accepted by the GNU patch tool. If C(remote_src) is 'no', the patch source file is looked up from the module's I(files) directory. required: true type: path dest: aliases: - originalfile description: - Path of the file on the remote machine to be patched. - The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified with this option. type: path state: choices: - absent - present default: present description: - Whether the patch should be applied or reverted. type: str version_added: '2.6' version_added_collection: ansible.builtin strip: default: 0 description: - Number that indicates the smallest prefix containing leading slashes that will be stripped from each file name found in the patch file. - For more information see the strip parameter of the GNU patch tool. type: int backup: default: false description: - Passes C(--backup --version-control=numbered) to patch, producing numbered backup copies. type: bool version_added: '2.0' version_added_collection: ansible.builtin binary: default: false description: - Setting to C(yes) will disable patch's heuristic for transforming CRLF line endings into LF. - Line endings of src and dest must match. - If set to C(no), C(patch) will replace CRLF in C(src) files on POSIX. type: bool version_added: '2.0' version_added_collection: ansible.builtin basedir: description: - Path of a base directory in which the patch file will be applied. - May be omitted when C(dest) option is specified, otherwise required. type: path remote_src: default: false description: - If C(no), it will search for src at originating/master machine, if C(yes) it will go to the remote/target machine for the C(src). type: bool