• hostvars 可以让你调用其他host的变量和facts,  即使你没有在这个机器上执行过playbook, 你仍然可以访问变量, 但是不能访问facts. 例如: {{ hostvars['test.example.com']['ansible_distribution'] }}
    • group_names 当前host所在的group的组名列表.   包括其父组
    • groups 所有组包括组中的hosts
    • inventory_hostname 配置在inventory文件中当前机器的hostname
    • play_hosts 执行当前playbook的所有机器的列表
    • inventory_dir inventory文件的路径
    • inventory_file inventory文件的路径和文件名
    • role_path 当前role的路径

相关文章:

  • 2021-12-19
  • 2022-12-23
  • 2021-06-13
  • 2021-12-17
  • 2021-07-29
  • 2022-12-23
猜你喜欢
  • 2021-06-06
  • 2021-10-11
  • 2021-12-05
  • 2022-02-11
  • 2021-12-30
  • 2021-11-24
  • 2021-12-11
相关资源
相似解决方案