forked from FestaLab/railway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_web_production.yml
60 lines (50 loc) · 2.06 KB
/
setup_web_production.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
- hosts: localhost
gather_facts: False
tasks:
- name: Obtain RDS host
community.aws.rds_instance_info:
region: "{{ aws_region }}"
filters:
"db-instance-id": "{{ app_name }}-db-{{ ansible_environment }}"
register: register_rds_info
- name: Obtain Elasticache Job host
community.aws.elasticache_info:
region: "{{ aws_region }}"
name: "{{ app_name }}-elasticache-{{ ansible_environment }}-job"
register: register_elasticache_job_info
- name: Obtain Elasticache Cache host
community.aws.elasticache_info:
region: "{{ aws_region }}"
name: "{{ app_name }}-elasticache-{{ ansible_environment }}-cache"
register: register_elasticache_cache_info
- set_fact:
rds_host: "{{ register_rds_info.instances[0].endpoint.address }}"
redis_job_host: "{{ register_elasticache_job_info.elasticache_clusters[0].cache_nodes[0].endpoint.address }}"
redis_cache_host: "{{ register_elasticache_cache_info.elasticache_clusters[0].cache_nodes[0].endpoint.address }}"
- hosts: _railway_ec2_production_webserver
remote_user: ansible
become: yes
roles:
- role: aws_cloudwatch
param_name: "{{ ansible_environment }}"
param_hostname: "web{{ play_hosts.index(inventory_hostname) }}"
param_process_type: web
tags: aws_cloudwatch
- role: aws_hostname
param_name: "web{{ play_hosts.index(inventory_hostname) }}"
- role: app_bootstrap
param_name: "{{ ansible_environment }}"
param_env_vars: complete
param_host: "https://{{ app_host }}"
param_rds_host: "{{ hostvars['localhost']['rds_host'] }}"
param_redis_job_host: "{{ hostvars['localhost']['redis_job_host'] }}"
param_redis_cache_host: "{{ hostvars['localhost']['redis_cache_host'] }}"
tags: app_bootstrap
- role: app_database_create
param_name: "{{ ansible_environment }}"
tags: app_database_create
- role: app_application_server
param_name: "{{ ansible_environment }}"
param_port: 3000
tags: app_application_server