community.general.dpkg_divert – Override a debian package’s version of a file
This plugin is part of the community.general collection (version 3.7.0).
To install it use:
ansible-galaxy collection install community.general.
To use it in a playbook, specify:
New in version 0.2.0: of community.general
A diversion is for
dpkgthe knowledge that only a given package (or the local administrator) is allowed to install a file at a given location. Other packages shipping their own version of this file will be forced to divert it, i.e. to install it at another location. It allows one to keep changes in a file provided by a debian package by preventing its overwrite at package upgrade.
This module manages diversions of debian packages files using the
dpkg-divertcommandline tool. It can either create or remove a diversion for a given file, but also update an existing diversion to modify its holder and/or its divert location.
The below requirements are needed on the host that executes this module.
dpkg-divert >= 1.15.0 (Debian family)
- name: Divert /usr/bin/busybox to /usr/bin/busybox.distrib and keep file in place community.general.dpkg_divert: path: /usr/bin/busybox - name: Divert /usr/bin/busybox by package 'branding' community.general.dpkg_divert: path: /usr/bin/busybox holder: branding - name: Divert and rename busybox to busybox.dpkg-divert community.general.dpkg_divert: path: /usr/bin/busybox divert: /usr/bin/busybox.dpkg-divert rename: yes - name: Remove the busybox diversion and move the diverted file back community.general.dpkg_divert: path: /usr/bin/busybox state: absent rename: yes force: yes
Common return values are documented here, the following are the fields unique to this module: