Get the hostname from the hosts file

后端 未结 1 893
南旧
南旧 2021-01-24 13:28

I would like to get another host from one of my templates.

Given the following hosts file:

[vm]
vm_hostname

[monitoring]
monitoring_hostnam         


        
相关标签:
1条回答
  • 2021-01-24 14:09

    You want to use groups magic variable, not hostvars:

    monitor: "{{ groups['monitoring'][0] }}"
    
    0 讨论(0)
提交回复
热议问题