SaltStack 常用模块介绍 - host

salt-minion-1:
    ----------
    host:
        
        Management of addresses and names in hosts file
        ===============================================
        
        The ``/etc/hosts`` file can be managed to contain definitions for specific hosts:
        
            salt-master:
              host.present:
                - ip: 192.168.0.42
        
        Or using the ``names`` directive, you can put several names for the same IP.
        (Do not try one name with space-separated values).
        
            server1:
              host.present:
                - ip: 192.168.0.42
                - names:
                  - server1
                  - florida
        
        Note:
        
            Changing the ``names`` in ``host.present`` does not cause an
            update to remove the old entry.
        
            server1:
              host.present:
                - ip:
                  - 192.168.0.42
                  - 192.168.0.43
                  - 192.168.0.44
                - names:
                  - server1
        
    host.absent:
host.present: Ensure that the named host is absent name The host to remove ip The ip addr(s) of the host to remove

ES
/etc/hosts:
host.present:
- ip:
- 172.17.0.2
- names:
- ab
- bc
- cd

备注: 可以用于管理node 服务器上面的hosts文件。

 

posted @ 2017-06-27 15:17  路路能手  阅读(184)  评论(0编辑  收藏  举报