官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 和平区| 沾益县| 韶关市| 拉萨市| 合江县| 麻栗坡县| 文化| 油尖旺区| 黄浦区| 米脂县| 潞城市| 梨树县| 寻乌县| 梓潼县| 察隅县| 齐齐哈尔市| 湛江市| 龙井市| 沙坪坝区| 巴东县| 东台市| 礼泉县| 波密县| 新巴尔虎右旗| 措美县| 定日县| 富平县| 屯门区| 敖汉旗| 依安县| 伊宁市| 都昌县| 宾阳县| 利川市| 千阳县| 通渭县| 濮阳市| 乌鲁木齐市| 香港| 长沙县| 宜州市|