Ansible-Bulk Linux management tools
"Ansible is easy it Automation"--simple automated IT tools.
- Batch execution of commands on a remote server
- Automating the deployment of apps
- Automation Management Configuration Items
- Automated Cloud service Management
Install (Ubuntu)
Rely on SSH and python
Apt-get Install Ansible
Configuration file
Ensure that the managed server can use the 密钥认证
login
The default path can be specified by modifying the hostfile parameter of the ANSIBLE.CFG
Vim/etc/ansible/hosts
Use
Time to view all servers
Ansible all-a "Date"
Modules for Ansible
Ansible to do some remote management work in a modular way
All modules can be viewed via ansible-doc-l
You can use the Ansible-doc-s module to view more detailed information about the module
PlayBook
Batch execution of a set of tasks by reading a configured file, with a YAML syntax structure for the configuration file
Composition of the PlayBook
Defines the playbook that will be executed. 远程主机组
Define playbook allow is required for 变量
use
Defines what will be performed on the remote host. 任务列表
Defines what needs to be called after the task execution completes.回调任务
Examples of PLAYBOOK.YML
- hosts: webserversvars: http_port: 80 max_clients: 200remote_user: roottasks:- name: ensure apache is at the latest version yum: pkg=httpd state=latest- name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf notify: - restart apache
Run Playbook
Ansible-playbook PLAYBOOK.YML-F10
Related Help
- Learning Video: http://edu.51cto.com/course/course_id-2220.html
Ansible-Bulk Linux management tools