初識Ansible

初識Ansible
Control Node
Managed Nodes
Inventory
A list of files, define the managed nodes
The default location: /etc/ansible/hosts
Format of files:
INI
YAML
Run
Use Ad-Hoc command
$ ansible [pattern] -m [module] -a "[module options]"
Eg:
$ ansible webservers -a "/sbin/reboot"
$ ansible dbservers -m ansible.builtin.copy -a "src=/etc/hosts dest=/tmp/hosts"
Use Playbooks
Create playbook file
Run Playbook
$ ansible-playbook -i inventory.yaml playbook.yaml
Output
標(biāo)簽: