0
IM有限制Ansible一個問題只與特定的主機工作工作ansible-劇本--limit不重疊的主機別名
我的庫存文件看起來像這樣:
[staging-docker-containers]
app1 ansible_host=host.domain.com ansible_ssh_port=2222
app2 ansible_host=host.domain.com ansible_ssh_port=2223
app3 ansible_host=host.domain.com ansible_ssh_port=2224
[staging-other-servers]
app1 ansible_host=host.domain.com ansible_ssh_port=2225
app2 ansible_host=host.domain.com ansible_ssh_port=2226
app3 ansible_host=host.domain.com ansible_ssh_port=2227
當我運行遵循命令
ansible-playbook --limit="staging-docker-containers:app3" my-playbook.yml -i staging
它忽略了限制命令,並嘗試連接staging-other-servers
組下APP3,而不是下staging-docker-containers
克APP3 roup。
我做錯了什麼?
我試着去使用主機別名特定角色映射到主機spesific一樣,我發現我的即時通訊例如,你對如何做到這一點建議嗎? – Urban48
@ Urban48我不確定你想要達到什麼樣的目標......通常你想用不同的庫存文件進行分段/製作,使用相同的組名,並在你的劇本中爲特定的組/主機分配特定的角色,使用'hosts :'。 –