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

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. 

主站蜘蛛池模板: 奉新县| 会宁县| 肇州县| 惠水县| 潮州市| 通河县| 东方市| 洛宁县| 辛集市| 会理县| 茌平县| 惠安县| 乌兰察布市| 科尔| 项城市| 竹北市| 福建省| 和静县| 柏乡县| 兰溪市| 东乡族自治县| 额济纳旗| 桐梓县| 巴南区| 屏边| 台北县| 波密县| 都兰县| 康马县| 墨竹工卡县| 涞源县| 迁安市| 宝坻区| 墨脱县| 凤阳县| 嘉定区| 沈丘县| 洪洞县| 保亭| 应城市| 五大连池市|