gpt4 book ai didi

远程收集事实时 JAVA_HOME 不在 Ansible 环境中

转载 作者:搜寻专家 更新时间:2023-11-01 03:31:48 24 4
gpt4 key购买 nike

<分区>

我有一个 Ansible 剧本,希望在 ansible_env 中找到 JAVA_HOME。当我针对远程安装了 Oracle Java 8 的 Ubuntu 16.04 主机运行它时,缺少 JAVA_HOME 和其他 Java 变量。但是,当我使用 ansible -K --become -m setup -c local localhost 在目标主机上本地收集事实时,我看到了它们。我的管理工作站和目标主机都是运行通过 APT 安装的 Ansible 2.5 的 Ubuntu 16.04。是什么造成了差异?当 JAVA_HOME 远程运行时,如何让它对 Ansible 可见?

请注意,问题不在于如何在 playbook 执行期间设置 JAVA_HOME,也不在于调用 shell 的解决方法。我试图了解为什么 JAVA_HOME 没有出现在人们期望找到它的地方。

远程收集的环境:

"ansible_env": {
"HOME": "/root",
"LANG": "en_US.UTF-8",
"LANGUAGE": "en_US:en",
"LC_ADDRESS": "he_IL.UTF-8",
"LC_ALL": "en_US.UTF-8",
"LC_IDENTIFICATION": "he_IL.UTF-8",
"LC_MEASUREMENT": "he_IL.UTF-8",
"LC_MESSAGES": "en_US.UTF-8",
"LC_MONETARY": "he_IL.UTF-8",
"LC_NAME": "he_IL.UTF-8",
"LC_NUMERIC": "en_US.UTF-8",
"LC_PAPER": "he_IL.UTF-8",
"LC_TELEPHONE": "he_IL.UTF-8",
"LC_TIME": "en_US.UTF-8",
"LOGNAME": "root",
"MAIL": "/var/mail/root",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin",
"PWD": "/home/local/VELOQUANT/yitzikc",
"SHELL": "/bin/bash",
"SUDO_COMMAND": "/bin/sh -c echo BECOME-SUCCESS-ejewjujifuuqrzzrkbjlmewadhlixwgh; /usr/bin/python /home/local/VELOQUANT/yitzikc/.ansible/tmp/ansible-tmp-1524498140.22-96857206506570/setup.py",
"SUDO_GID": "527958529",
"SUDO_UID": "527959121",
"SUDO_USER": "yitzikc",
"TERM": "xterm",
"USER": "root",
"USERNAME": "root"
}

本地收集的环境:

    "ansible_env": {
"DERBY_HOME": "/usr/lib/jvm/java-8-oracle/db",
"DISPLAY": "localhost:10.0",
"GTK_MODULES": "gail:atk-bridge",
"HOME": "/root",
"J2REDIR": "/usr/lib/jvm/java-8-oracle/jre",
"J2SDKDIR": "/usr/lib/jvm/java-8-oracle",
"JAVA_HOME": "/usr/lib/jvm/java-8-oracle",
"LANG": "en_US.UTF-8",
"LANGUAGE": "en_US:en",
"LC_ADDRESS": "he_IL.UTF-8",
"LC_ALL": "en_US.UTF-8",
"LC_IDENTIFICATION": "he_IL.UTF-8",
"LC_MEASUREMENT": "he_IL.UTF-8",
"LC_MESSAGES": "en_US.UTF-8",
"LC_MONETARY": "he_IL.UTF-8",
"LC_NAME": "he_IL.UTF-8",
"LC_NUMERIC": "en_US.UTF-8",
"LC_PAPER": "he_IL.UTF-8",
"LC_TELEPHONE": "he_IL.UTF-8",
"LC_TIME": "en_US.UTF-8",
"LESSCLOSE": "/usr/bin/lesspipe %s %s",
"LESSOPEN": "| /usr/bin/lesspipe %s",
"LOGNAME": "root",
"MAIL": "/var/mail/yitzikc",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin",
"PWD": "/home/local/VELOQUANT/yitzikc",
"SHELL": "/bin/bash",
"SHLVL": "1",
"SSH_CLIENT": "172.30.1.183 51808 22",
"SSH_CONNECTION": "172.30.1.183 51808 172.30.1.121 22",
"SSH_TTY": "/dev/pts/0",
"SUDO_COMMAND": "/bin/sh -c echo BECOME-SUCCESS-injqonohmutwfdyspntuiuaanynmjljw; /usr/bin/python /home/local/VELOQUANT/yitzikc/.ansible/tmp/ansible-tmp-1524498257.19-88347143844147/setup.py",
"SUDO_USER": "yitzikc",
"TERM": "xterm",
"USER": "root",
"USERNAME": "root",
"XDG_DATA_DIRS": "/usr/local/share:/usr/share:/var/lib/snapd/desktop",
"XDG_RUNTIME_DIR": "/run/user/527959121",
"XDG_SESSION_ID": "73",
"_": "/usr/bin/ansible"
},

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com