I'm currently writing an Ansible role that applies my dconf settings. I have a file rolename/vars/main.yml
which holds all the dconf keys and values:
gnome_dconf:
- key: "/org/gnome/desktop/background/picture-uri"
value: "'file:///usr/share/backgrounds/gnome/bell_heather_spekes_mill.jpg'"
- key: "/org/gnome/desktop/calendar/show-weekdate"
value: "true"
- key: "/org/gnome/desktop/datetime/automatic-timezone"
value: "true"
- key: "/org/gnome/desktop/input-sources/per-window"
value: "false"
- key: "/org/gnome/desktop/input-sources/sources"
value: "[('xkb', 'gb')]"
- key: "/org/gnome/desktop/input-sources/xkb-options"
value: "['lv3:ralt_switch', 'compose:ralt']"
- key: "/org/gnome/desktop/interface/clock-format"
value: "'12h'"
...
I then use the following task, at rolename/tasks/main.yml
, to apply the list to the dconf database:
- name: Configuring dconf
community.general.dconf:
key: '{{ item.key }}'
value: '{{ item.value }}'
state: present
with_items: '{{ gnome_dconf }}'
This the trouble is, this changes all the round brackets ()
in the values to square ones []
(I have confirmed this by writing the outputted values to a file with ansible.builtin.lineinfile).
e.g: [('xkb', 'gb')]
is written as [['xkb', 'gb']]
I've tried escaping and quoting every way I can think of but explicitly writing the key and value in the task works as expected:
# this works fine
- name: Configuring dconf
community.general.dconf:
key: "/org/gnome/desktop/input-sources/sources"
value: "[('xkb', 'gb')]"
state: present
That is not an ideal or feasible solution, as I have around 150 values to apply. Am I missing something here or is this a bug?