网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

ansible-主机清单的配置

1. ansible主机清单的配置

城固网站制作公司哪家好,找创新互联建站!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联建站2013年开创至今到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联建站

    以下是ansible安装完成后的源文件

[root@test-1 ~]# cat /etc/ansible/hosts
    # This is the default ansible 'hosts' file.
    #
    # It should live in /etc/ansible/hosts
    #
    #   - Comments begin with the '#' character
    #   - Blank lines are ignored
    #   - Groups of hosts are delimited by [header] elements
    #   - You can enter hostnames or ip addresses
    #   - A hostname/ip can be a member of multiple groups
    
    # Ex 1: Ungrouped hosts, specify before any group headers.
    [webservers]
    192.168.200.131  ansible_host_user=root ansible_host_pass='123456'
    192.168.200.132
    192.168.200.133
    192.168.200.134
    192.168.200.135
    192.168.200.136
    
    ## green.example.com
    ## blue.example.com
    ## 192.168.100.1
    ## 192.168.100.10
    
    # Ex 2: A collection of hosts belonging to the 'webservers' group
    
    ## [webservers]
    ## alpha.example.org
    ## beta.example.org
    ## 192.168.1.100
    ## 192.168.1.110
    
    # If you have multiple hosts following a pattern you can specify
    # them like this:
    
    ## www[001:006].example.com
    
    # Ex 3: A collection of database servers in the 'dbservers' group
    
    ## [dbservers]
    ## 
    ## db01.intranet.mydomain.net
    ## db02.intranet.mydomain.net
    ## 10.25.1.56
    ## 10.25.1.57
    
    # Here's another example of host ranges, this time there are no
    # leading 0s:
    
    ## db-[99:101]-node.example.com

2. ansible定义方式:

1) 直接指明主机地址或主机名

test_2.xxxx.cn2         
192.168.200.132

   2) 定义一个主机组 [  组名  ]  把地址或主机名加进去

[webservers]
        192.168.200.131  ansible_host_user=root ansible_host_pass='123456'
        192.168.200.132
        192.168.200.133
        192.168.200.134
        192.168.200.135
        192.168.200.136

 3) 如果你没有使用公钥,想要使用密码,你也可以这样写(适用于第一次登陆控制)

格式:【主机名】       【指定用户】    【主机地址】   【主机密码】
[webservers]
192.168.200.131    ansible_host_user=root    test-1=192.168.200.131      ansible_host_pass='123456'

文章标题:ansible-主机清单的配置
本文来源:http://bjjierui.cn/article/ggipgo.html

其他资讯