I have printed out the facts for the host with:
- name: Display all variables/facts known for a host
debug: var=hostvars[inventory_hostname]
How do I know what the desktop environment is?
The closest I found was:
"COLORTERM": "gnome-terminal",
I was using this condition
ansible_env["SESSIONTYPE"] == "gnome-session"
But when running as sudo
with become
that fact is not present
如果这对您很重要,则可能需要设计自己的事实模块。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.