community.general.gio_mime module – Set default handler for MIME type, for applications using Gnome GIO

Note

This module is part of the community.general collection (version 8.5.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.gio_mime.

New in community.general 7.5.0

Synopsis

  • This module allows configuring the default handler for a specific MIME type, to be used by applications built with th Gnome GIO API.

Parameters

Parameter

Comments

handler

string / required

Default handler will be set for the MIME type.

mime_type

string / required

MIME type for which a default handler will be set.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • This module is a thin wrapper around the gio mime command (and subcommand).

  • See man gio(1) for more details.

See Also

See also

GIO Documentation

Reference documentation for the GIO API..

Examples

- name: Set chrome as the default handler for https
  community.general.gio_mime:
    mime_type: 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

handler

string

The handler set as default.

Returned: success

Sample: "google-chrome.desktop"

stderr

string

The error output of the gio command.

Returned: failure

Sample: "gio: Failed to load info for handler \"never-existed.desktop\""

stdout

string

The output of the gio command.

Returned: success

Sample: "Set google-chrome.desktop as the default for x-scheme-handler/https"

Authors

  • Alexei Znamensky (@russoz)