ansible.builtin.dconf (v2.9.27) — module

Modify and read dconf database

| "added in version" 2.4 of ansible.builtin"

Authors: Branko Majic (@azaghal)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

This module allows modifications and reading of dconf database. The module is implemented as a wrapper around 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).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure available keyboard layouts in Gnome
  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
  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
  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
  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
  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
  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
  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

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

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 C(state=present).
    required: false

Outputs

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