community.general.xdg_mime module – Set default handler for MIME types, for applications using XDG tools
Note
This module is part of the community.general collection (version 11.3.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.xdg_mime
.
New in community.general 10.7.0
Synopsis
This module allows configuring the default handler for specific MIME types when you use applications that rely on XDG.
Parameters
Parameter |
Comments |
---|---|
Sets the default handler for the specified MIME types. The desktop file must be installed in the system. If the desktop file is not installed, the module does not fail, but the handler is not set either. You must pass a handler in the form |
|
One or more MIME types for which a default handler is set. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
Notes
Note
This module is a thin wrapper around
xdg-mime
tool.See man xdg-mime(1) for more details.
See Also
See also
- C(xdg-mime) command manual page
Manual page for the command.
- xdg-utils Documentation
Reference documentation for xdg-utils.
Examples
- name: Set Chrome as the default handler for HTTPS
community.general.xdg_mime:
mime_types: x-scheme-handler/https
handler: google-chrome.desktop
register: result
- name: Set Chrome as the default handler for both HTTP and HTTPS
community.general.xdg_mime:
mime_types:
- x-scheme-handler/http
- x-scheme-handler/https
handler: google-chrome.desktop
register: result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Currently set handlers for the passed MIME types. Returned: success Sample: |
|
Version of the Returned: always Sample: |