How can I purge a package using the apt_get package_module? policy => purge doesn't work.

present and absent are the package states, purge is an option for package manager. You should be able to use the options attribute since the apt_get package module supports it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  bundle agent main
  {
    packages:

        # Purging a package using the --purge option
        "screen"
          policy => "absent",
          package_module => apt_get,
          options => { "--remove" };
  }

Note that you can use any Configuration Item as well:

1
2
3
4
5
6
7
8
  bundle agent main
  {
        # Purging a package using the Configuration Item option
        "screen"
          policy => "absent",
          package_module => apt_get,
          options => { "-o", "APT::Get::Purge=true" };
  }