资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

ansible-主机清单的配置-创新互联

1. ansible主机清单的配置

成都创新互联公司咨询热线:18980820575,为您提供成都网站建设网页设计及定制高端网站建设服务,成都创新互联公司网页制作领域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'

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页名称:ansible-主机清单的配置-创新互联
URL链接:http://cdkjz.cn/article/dgpcop.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220