- Ansible Playbook Essentials
- Gourav Shah
- 317字
- 2021-07-16 20:47:47
Getting introduced to Ansible
Ansible is a simple, flexible, and extremely powerful tool that gives you the ability to automate common infrastructure tasks, run ad hoc commands, and deploy multitier applications spanning multiple machines. Even though you can use Ansible to launch commands on a number of hosts in parallel, the real power lies in managing those using playbooks.
As systems engineer, infrastructure that we typically need to automate contains complex multitier applications. Each of which represents a class of servers, for example, load balancers, web servers, database servers, caching applications, and middleware queues. Since many of these applications have to work in tandem to provide a service, there is topology involved as well. For example, a load balancer would connect to web servers, which in turn read/write to a database and connect to the caching server to fetch in-memory objects. Most of the time, when we launch such application stacks, we need to configure these components in a very specific order.
Here is an example of a very common three-tier web application running a load balancer, a web server, and a database backend:

Ansible lets you translate this diagram into a blueprint, which defines your infrastructure policies. The format used to specify such policies is what playbooks are.
Example policies and the sequence in which those are to be applied is shown in the following steps:
- Install, configure, and start the MySQL service on the database servers.
- Install and configure the web servers that run Nginx with PHP bindings.
- Deploy a Wordpress application on the web servers and add respective configurations to Nginx.
- Start the Nginx service on all web servers after deploying Wordpress. Finally, install, configure, and start the haproxy service on the load balancer hosts. Update haproxy configurations with the hostnames of all the web servers created earlier.
The following is a sample playbook that translates the infrastructure blueprint into policies enforceable by Ansible:

- SQL Server 從入門到項目實踐(超值版)
- Google Apps Script for Beginners
- Python零基礎快樂學習之旅(K12實戰訓練)
- Spring核心技術和案例實戰
- Mastering Data Mining with Python:Find patterns hidden in your data
- Instant PHP Web Scraping
- Hands-On JavaScript for Python Developers
- PrimeFaces Blueprints
- 青少年學Python(第2冊)
- Python網絡爬蟲實例教程(視頻講解版)
- Sitecore Cookbook for Developers
- Java服務端研發知識圖譜
- Java Web應用開發
- MATLAB計算機視覺實戰
- Spring MVC Blueprints