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

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. 

主站蜘蛛池模板: 叶城县| 济宁市| 桦川县| 东丽区| 江永县| 山东省| 芦溪县| 怀集县| 内乡县| 新津县| 灵寿县| 饶阳县| 佛冈县| 沧州市| 辉南县| 信阳市| 正宁县| 称多县| 尼勒克县| 哈密市| 河池市| 股票| 抚远县| 富锦市| 和静县| 乐山市| 天长市| 青田县| 晋江市| 莱西市| 太和县| 包头市| 永川市| 三穗县| 富顺县| 镇远县| 钟山县| 绥芬河市| 平乡县| 民乐县| 温泉县|