- Mastering Ceph
- Nick Fisk
- 189字
- 2021-07-09 19:55:15
A very simple playbook
To demonstrate how playbooks work, the following example will show a small playbook that also makes use of the variables we configured earlier:
- hosts: mon1 osd1
tasks:
- name: Echo Variables
debug: msg="I am a {{ a_variable }}"
Now run the playbook. Note the command to run a playbook that differs from running ad hoc Ansible commands:
$ ansible-playbook /etc/ansible/playbook.yml
The preceding command gives the following output:

The output shows the playbook being executed on both mon1 and osd1 as they are in groups, which are children of the parent group ceph. Also, note how the output is different between the two servers as they are picking up the variables that you set earlier in the group_vars directory.
Finally, the last couple of lines show the overall run status of the playbook run. You can now destroy your Vagrant environment again, ready for the next section:
vagrant destroy --force
This concludes the introduction to Ansible, but it is not a complete guide. It's recommended that you should explore other resources to gain a more in-depth knowledge of Ansible before using it in a production environment.
- 電力自動化實用技術問答
- 火格局的時空變異及其在電網防火中的應用
- Mastering Spark for Data Science
- 21天學通PHP
- Ansible Quick Start Guide
- 輕松學PHP
- Hands-On Neural Networks with Keras
- Hands-On Cybersecurity with Blockchain
- CorelDRAW X4中文版平面設計50例
- 21天學通Visual Basic
- Photoshop CS5圖像處理入門、進階與提高
- 一步步寫嵌入式操作系統
- 和機器人一起進化
- 貫通開源Web圖形與報表技術全集
- 樂高創意機器人教程(中級 上冊 10~16歲) (青少年iCAN+創新創意實踐指導叢書)