Note
This plugin is part of the ansible.posix collection.
To install it use: ansible-galaxy collection install ansible.posix
.
To use it in a playbook, specify: ansible.posix.patch
.
New in version 1.0.0: of ansible.posix
Note
This module has a corresponding action plugin.
Parameter | Choices/Defaults | Comments |
---|---|---|
backup boolean |
| Passes --backup --version-control=numbered to patch, producing numbered backup copies. |
basedir path | Path of a base directory in which the patch file will be applied. May be omitted when dest option is specified, otherwise required. | |
binary boolean |
| Setting to yes will disable patch's heuristic for transforming CRLF line endings into LF.Line endings of src and dest must match. If set to no , patch will replace CRLF in src files on POSIX. |
dest path | 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. aliases: originalfile | |
ignore_whitespace boolean |
| Setting to yes will ignore white space changes between patch and input.. |
remote_src boolean |
| If no , it will search for src at originating/controller machine, if yes it will go to the remote/target machine for the src . |
src path / required | Path of the patch file as accepted by the GNU patch tool. If remote_src is 'no', the patch source file is looked up from the module's files directory.aliases: patchfile | |
state string |
| Whether the patch should be applied or reverted. |
strip integer | Default: 0 | 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. |
Note
- name: Apply patch to one file ansible.posix.patch: src: /tmp/index.html.patch dest: /var/www/index.html - name: Apply patch to multiple files under basedir ansible.posix.patch: src: /tmp/customize.patch basedir: /var/www strip: 1 - name: Revert patch to one file ansible.posix.patch: src: /tmp/index.html.patch dest: /var/www/index.html state: absent
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/posix/patch_module.html