【问题标题】:ansible - cant set wallpaper in xfce4 with xfconf "failed to init libxfconf "ansible - 无法使用 xfconf 在 xfce4 中设置壁纸“无法初始化 libxfconf”
【发布时间】:2021-06-09 14:15:06
【问题描述】:

我尝试在 xfce4 桌面上使用 ansible 在 Debian 系统上设置墙纸。为此我查阅了官方文档:https://docs.ansible.com/ansible/latest/collections/community/general/xfconf_module.html

我的任务:

  - 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

我收到以下错误:

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"
        ]
    }
}

我考虑将 xfce4-desktop 的 xml 配置复制到每台机器上,但并非每台机器都具有相同的屏幕“监视器”属性。

【问题讨论】:

    标签: ansible xfce


    【解决方案1】:

    让它工作。似乎以 root 身份运行任务就可以了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多