A fully-featured inventory file can serve as the source of truth for your network. Using an inventory file, a single playbook can maintain hundreds of network devices with a single command. This page shows you how to build an inventory file, step by step.
Ansible 2.8 Documentation
沒錯,只要你的Inventory file設定好,所有在Inventory中的伺服器都任你指揮!
基本的Inventory可以這樣設定:
# you can specify the user and ssh port number of this server# Inventory Parameters# ansible_connection=ssh/winrm/local# ansible_port=22# ansible_user=root/administrator# ansible_ssh_pass=passwordweb1 ansible_host=webserver.com ansible_connection=ssh ansible_user=webuser ansible_ssh_pass=webPass!localhost ansible_connection=local