Using facts from one host group to configure another host group with Ansible

后端 未结 1 669
鱼传尺愫
鱼传尺愫 2020-12-19 22:17

I am trying to configure one set of hosts [nodes] using facts from another set of hosts [etcd]. Here is my hosts file

[master]
kubernetes ansib         


        
相关标签:
1条回答
  • 2020-12-19 23:10

    If you want to use facts of some host, you should gather them first.
    Run setup task on [etcd] hosts to populate hostvars.

    ---
    - name: Gather etcd facts
      hosts: etcd
      tasks:
        - setup:
    
    - name: Configure common
      hosts: nodes
      sudo: True
      tasks:
        - name: etcd endpoints
          file: dest=/etc/kubernetes state=directory
    
        - name: etcd endpoints
          template: src=files/k.j2 dest=/etc/kubernetes/apiserver
    
    0 讨论(0)
提交回复
热议问题