community.general.dconf (8.5.0) — module

Modify and read dconf database

Authors: Branko Majic (@azaghal)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module allows modifications and reading of C(dconf) database. The module is implemented as a wrapper around C(dconf) tool. Please see the dconf(1) man page for more details.

Since C(dconf) requires a running D-Bus session to change values, the module will try to detect an existing session and reuse it, or run the tool via C(dbus-run-session).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure available keyboard layouts in Gnome
  community.general.dconf:
    key: "/org/gnome/desktop/input-sources/sources"
    value: "[('xkb', 'us'), ('xkb', 'se')]"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Read currently available keyboard layouts in Gnome
  community.general.dconf:
    key: "/org/gnome/desktop/input-sources/sources"
    state: read
  register: keyboard_layouts
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reset the available keyboard layouts in Gnome
  community.general.dconf:
    key: "/org/gnome/desktop/input-sources/sources"
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure available keyboard layouts in Cinnamon
  community.general.dconf:
    key: "/org/gnome/libgnomekbd/keyboard/layouts"
    value: "['us', 'se']"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Read currently available keyboard layouts in Cinnamon
  community.general.dconf:
    key: "/org/gnome/libgnomekbd/keyboard/layouts"
    state: read
  register: keyboard_layouts
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reset the available keyboard layouts in Cinnamon
  community.general.dconf:
    key: "/org/gnome/libgnomekbd/keyboard/layouts"
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable desktop effects in Cinnamon
  community.general.dconf:
    key: "/org/cinnamon/desktop-effects"
    value: "false"
    state: present

Inputs

    
key:
    description:
    - A dconf key to modify or read from the dconf database.
    required: true
    type: str

state:
    choices:
    - read
    - present
    - absent
    default: present
    description:
    - The action to take upon the key/value.
    required: false
    type: str

value:
    description:
    - Value to set for the specified dconf key. Value should be specified in GVariant
      format. Due to complexity of this format, it is best to have a look at existing
      values in the dconf database.
    - Required for O(state=present).
    - Although the type is specified as "raw", it should typically be specified as a string.
      However, boolean values in particular are handled properly even when specified as
      booleans rather than strings (in fact, handling booleans properly is why the type
      of this parameter is "raw").
    required: false
    type: raw

Outputs

value:
  description: value associated with the requested key
  returned: success, state was "read"
  sample: '''Default'''
  type: str