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

How to do it…

  1. In a previous recipe, we created an Elastic IP and registered the value of the output. We are going to use that and add it to a group called phonebook-infra:
- name: Adding Elastic IP to the phonebook-infra
add_host:
hostname: "{{ eip.public_ip }}"
groups: phonebook-infra
  1. Once we are done with the add_host task in the EC2 role, our playbook can deploy the application by calling both the EC2 role and phonebook role like this:
---
- hosts: localhost
roles:
- ec2
- hosts: phonebook-infra
roles:
- phonebook

To understand the phonebook role better, we can refer to Chapter 1, Getting Started with Ansible and Cloud Management of this book. This playbook will create an EC2 instance and deploy the phonebook application on that instance. Since we are using a single instance, we will use SQLite as the database. 

主站蜘蛛池模板: 高唐县| 盖州市| 阿拉善盟| 云林县| 砀山县| 柳林县| 赤峰市| 黄骅市| 陕西省| 三穗县| 崇州市| 沐川县| 紫金县| 咸宁市| 郧西县| 西丰县| 岢岚县| 泸水县| 竹山县| 麦盖提县| 吴堡县| 梅州市| 任丘市| 咸宁市| 乌什县| 湖州市| 米林县| 陵川县| 三门县| 比如县| 喀什市| 诸城市| 峨边| 富川| 永登县| 东乌| 香港 | 秦皇岛市| 阳西县| 石家庄市| 壶关县|