# README

[![Markdown](https://img.shields.io/badge/%3C%2F%3E-Markdown-white.svg)](http://markdown.tw) [![GitHub](https://img.shields.io/badge/GitHub-chusiang%2Fautomate--with--ansible-black.svg)](https://github.com/chusiang/automate-with-ansible) [![GitBook](https://img.shields.io/badge/GitBook-ansible.drx.tw-blue.svg)](https://ansible.drx.tw) [![License: CC BY-NC-SA 3.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%203.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/3.0/)

Ansible 是個與 Puppet, SaltStack, Chef 並駕齊驅的組態設定 (Infrastructure as Code) 工具，其簡單易用的特性讓人愛不釋手，在 DevOps 界更佔有一席之地。

本次凍仁將帶領大家一探 Ansible 這門技藝，並分享些實戰經驗。相信有了 Ansible 我們都可以提早下班了！ (笑)

若需勘誤，觀迎大家來信 *automate-with-ansible (at) drx.tw*，(當然您也可以上 GitHub 網站 送 Pull Request 或發 issues)，讓此書可以更完美。

[![創用 CC 授權條款](https://i.creativecommons.org/l/by-nc-sa/3.0/tw/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/3.0/tw/)

《現代 IT 人一定要知道的 Ansible 自動化組態技巧》由[凍仁翔](http://note.drx.tw/)製作，以[創用CC 姓名標示-非商業性-相同方式分享 3.0 台灣 授權條款](http://creativecommons.org/licenses/by-nc-sa/3.0/tw/)釋出。

> 註：此份文件主要使用 2016/09/29 釋出的 **Ansible 2.1.2** 進行撰寫，部份語法和配置可能與現今有所出入，還請特別留意。

## 目錄

1. [前言](https://ansible.drx.tw/01.intro)
2. [Ansible 是什麼？](https://ansible.drx.tw/02.what-is-the-ansible)
3. [怎麼部署 Ansible 環境？](https://ansible.drx.tw/03.how-to-deploy-the-ansible)
4. [怎麼用 Vagrant 練習 Ansible？](https://ansible.drx.tw/04.how-to-practive-the-ansible-with-vagrant)
5. [怎麼用 Docker 練習 Ansible？](https://ansible.drx.tw/05.how-to-practive-the-ansible-with-docker)
6. [怎麼操作 Ansible？](https://ansible.drx.tw/06.how-to-use-the-ansible)
7. [怎麼用 Jupyter 操控 Ansible？(localhost)](https://ansible.drx.tw/07.how-to-practive-the-ansible-with-jupyter1)
8. [怎麼用 Jupyter 操控 Ansible？(Managed node)](https://ansible.drx.tw/08.how-to-practive-the-ansible-with-jupyter2)
9. [怎麼用 Docker Compose 練習 Ansible？](https://ansible.drx.tw/09.how-to-practive-the-ansible-with-docker-compose)
10. [Ansible 的開發工具有哪些？](https://ansible.drx.tw/10.which-are-the-ansible-developer-tools)
11. [怎麼看 Ansible Modules 文件？](https://ansible.drx.tw/11.how-to-see-the-ansible-module-document)
12. [常用的 Ansible Module 有哪些？](https://ansible.drx.tw/12.which-are-the-commonly-used-modules)
13. [怎麼使用 setup 取得 Managed node 的 facts？](https://ansible.drx.tw/13.how-to-get-the-managed-node-facts-with-setup)
14. [怎麼使用 Ansible 的 Template 系統？](https://ansible.drx.tw/14.how-to-use-the-ansible-template-system)
15. [怎麼在 Playbooks 裡使用 Handlers？](https://ansible.drx.tw/15.how-to-use-handlers-in-playbooks)
16. [Ansible 如何發送 notification 到 Slack？](https://ansible.drx.tw/16.how-to-send-notification-to-slack-on-ansible)
17. [Ansible 如何發送 notification 到 HipChat？](https://ansible.drx.tw/17.how-to-send-notification-to-hipchat-on-ansible)
18. [如何在 Playbooks 使用 loops？](https://ansible.drx.tw/18.how-to-use-loops-in-playbooks)
19. [如何維護大型的 Playbooks？](https://ansible.drx.tw/19.how-to-maintain-the-complex-playbooks)
20. [Roles 是什麼？](https://ansible.drx.tw/20.what-is-the-roles)
21. [怎麼使用 Roles？](https://ansible.drx.tw/21.how-to-use-the-roles)
22. [怎麼用 Roles 部署 LNMP 網頁應用程式？(上)](https://ansible.drx.tw/22.how-to-setup-lnmp-webapp-with-roles-1)
23. [怎麼用 Roles 部署 LNMP 網頁應用程式？(下)](https://ansible.drx.tw/23.how-to-setup-lnmp-webapp-with-roles-2)
24. [怎麼用 Roles 部署 TestLink？](https://ansible.drx.tw/24.how-to-setup-testlink-with-roles)
25. [怎麼在 Ansible Galaxy 分享 Roles？(上)](https://ansible.drx.tw/25.how_to_share_roles_on_galaxy-1)
26. [怎麼在 Ansible Galaxy 分享 Roles？(下)](https://ansible.drx.tw/26.how_to_share_roles_on_galaxy-2)
27. [怎麼用 Travis CI 測試 Roles？](https://ansible.drx.tw/27.how-to-test-the-roles-with-travis-ci)
28. [怎麼混用 Ansible 建置 Docker image？](https://ansible.drx.tw/28.how-to-build-docker-image-with-ansible)
29. [怎麼在 Docker Hub 混用 Ansible 自動建置 Docker image？](https://ansible.drx.tw/29.how-to-build-docker-image-with-ansible-on-docker-hub)
30. [怎麼用 Vault 管理敏感資料？](https://ansible.drx.tw/30.how-to-manage-sensitive-data-with-vault)
31. [總結](https://ansible.drx.tw/31.end)

## 誌謝

首先，最感謝的是我的妻子[儀萍](https://github.com/VioletChen)，除了繪製[本書封面](https://github.com/chusiang/automate-with-ansible/blob/main/cover.jpg)，在參賽期間還給予了不少支持和照料，要不是有她的督促和校稿凍仁是完成不了本書的。

謝謝從小在背後默默支持我的雙親陳玉鐘女士和賴松村先生，讓凍仁可以自由的發揮所長，走自己的路。

謝謝我的前主管羅春長 (Shortie) 先生，在 IT 這條漫漫長路上，總是在凍仁遇到難題時指點迷津，並在剛就職時就規劃了往後所需的工作技能，還放手讓凍仁在公司導入 Ansible、Docker 等新技術。

謝謝引領凍仁進入 Ansible 世界的[黃俊宏 (sakanamax)](https://twitter.com/sakanamax) 和[葉秉哲 (William Yeh)](https://twitter.com/william_yeh) 前輩，讓凍仁了解到導入組態工具後的世界有多美好。

最後還要謝謝 [Ansible 台灣使用者社群](http://ansible.tw/) (Ansible Taiwan User Group) 和曾幫助過凍仁的各位伙伴，要不是有他們就沒有昔日的凍仁。

1. 本書的 GitHub 網址為 <https://github.com/chusiang/automate-with-ansible>。
