I try to set a wallpaper on Debian Systems with ansible on xfce4 desktops. For this I looked up the official documentation: https://docs.ansible.com/ansible/latest/collections/community/general/xfconf_module.html
My Task:
- name: set wallpaper
become_user: odin
xfconf:
channel: "xfce4-desktop"
property: "/backdrop/screen0/{{item}}/image-path"
value_type: "string"
value: ['/usr/share/backgrounds/xfce/802192.jpg']
loop:
- monitor0
- monitor1
- monitorDP-1
- monitoreDP-1
I receive the following error:
XFConfException: xfconf-query failed with error (rc=1): Failed to init libxfconf: Error spawning command line “dbus-launch --autolaunch=2e66f568a1c34fda92dcec58e724b679 --binary-syntax --close-stderr”: Child process exited with code 1.
failed: [localhost] (item=monitoreDP-1) => {
"ansible_loop_var": "item",
"changed": false,
"invocation": {
"module_args": {
"channel": "xfce4-desktop",
"force_array": false,
"property": "/backdrop/screen0/monitoreDP-1/image-path",
"state": "present",
"value": [
"/usr/share/backgrounds/xfce/802192.jpg"
],
"value_type": [
"string"
]
}
},
"item": "monitoreDP-1",
"msg": "Module failed with exception: xfconf-query failed with error (rc=1): Failed to init libxfconf: Error spawning command line “dbus-launch --autolaunch=2e66f568a1c34fda92dcec58e724b679 --binary-syntax --close-stderr”: Child process exited with code 1.",
"output": {
"ansible_facts": {
"xfconf": {}
},
"cmd_args": [
"/usr/bin/xfconf-query",
"--channel",
"xfce4-desktop",
"--property",
"/backdrop/screen0/monitoreDP-1/image-path"
],
"force_lang": "C",
"rc": 1,
"stderr": "Failed to init libxfconf: Error spawning command line “dbus-launch --autolaunch=2e66f568a1c34fda92dcec58e724b679 --binary-syntax --close-stderr”: Child process exited with code 1.n",
"stdout": ""
},
"vars": {
"cmd_args": [
"/usr/bin/xfconf-query",
"--channel",
"xfce4-desktop",
"--property",
"/backdrop/screen0/monitoreDP-1/image-path"
]
}
}
I thought about copying the xml config for xfce4-desktop on to every machine, but not every machine has the same screen "monitor" property.
2
Answers
Got it to work. Seems like running the task as root was doing the trick.
The xfce modification works as root for me as well with the following approach:
This will configure the xfce files in
/root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
though.I was not able to do it for another user USERNAME, besides with this workaround:
If anybody know how to use xfconf module in a better way to overcome this workaround, please let me know.