fabric - 如何在部署时获取主机名

fabric - how to get host name while deploying

我有一个 fabfile

env.hosts = [
    # huge list, 80 hostnames
]
def dm():
    with cd('/home/project/application'):
        # how to get the actual hostname here, so I can run certain commands depending on hostname?

有什么想法吗?织物文档没有给我任何关于这个的信息

您可以使用 env.host 访问主机名。