patch

Collection: posix

Full Name: parallax.posix.patch

Aliases: ansible.posix.patch, patch

Synopsis

Apply a unified diff to files on the target

Parameters

NameTypeRequiredDefaultDescription
srcstringyesPath to the patch file to apply
deststringPath of the file on the remote host to patch
basedirstringPath of a base directory the patch is applied in (defaults to dest’s directory)
stripstring0Number of leading path components to strip from file names
remote_srcbooltrueThe patch file already exists on the target (parallax only supports true)
backupboolfalseCreate a backup of the original file(s)
binaryboolfalsePass –binary to patch, which reads and writes data in binary mode
statestringpresentWhether the patch should be applied (present) or reverted (absent)

Example

- name: Apply a vendor patch to the config
  patch:
    src: files/fix-timeout.patch
    basedir: /opt/vendor
    strip: 1
    backup: true
    state: present