溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

ansible-主機清單的配置

發布時間:2020-07-22 00:58:53 來源:網絡 閱讀:333 作者:跳跳彈 欄目:系統運維

1. ansible主機清單的配置

? ? 以下是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'


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女