In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Configuration of ansible host inventory
The following is the source file after the ansible installation is complete
[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 [001VAN006] .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 db- 101]-node.example.com
2. How ansible is defined:
1) specify the host address or host name directly
Test_2.xxxx.cn2 192.168.200.132
2) define a host group [group name] add the address or host name
[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) if you do not use the public key and want to use the password, you can also write this (for first login control)
Format: [hostname] [specified user] [host address] [host password] [webservers] 192.168.200.131 ansible_host_user=root test-1=192.168.200.131 ansible_host_pass='123456'
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.