Skip to content

Commit 0070905

Browse files
committed
support multiple cf stacks
1 parent 8f73d2e commit 0070905

File tree

4 files changed

+46
-44
lines changed

4 files changed

+46
-44
lines changed

deploy/deploy-cf-stack.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
then A to abort.
1717
when: cloudformation_stack_result is changed
1818

19-
- name: kubernetes cluster management
20-
hosts: cluster
19+
- name: cdn (cloudfront) management
20+
hosts: cdn
2121
gather_facts: false
2222
tags: cdn
2323
vars:
2424
ansible_connection: local
2525
ansible_python_interpreter: "{{ ansible_playbook_python }}"
26-
vars_files:
27-
- group_vars/cdn.yml
2826
roles:
2927
- role: caktus.aws-web-stacks
3028
tasks:

deploy/group_vars/all.yml

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,37 @@ admin_database_password: !vault |
2323
# provisioning with aws-web-stacks.
2424
# ----------------------------------------------------------------------------
2525

26-
stack_name: "{{ app_name }}-stack"
27-
28-
# cloudformation_stack:
29-
# region: "{{ aws_region }}"
30-
# stack_name: "{{ stack_name }}"
31-
# template_bucket: "aws-web-stacks-{{ app_name }}"
32-
# # Webstacks required variable
33-
# template_local_path: '{{ playbook_dir + "/stack/eks-no-nat.yml" }}'
34-
# create_changeset: true
35-
# termination_protection: true
36-
37-
# template_parameters:
38-
# PrimaryAZ: "{{ aws_region }}a"
39-
# SecondaryAZ: "{{ aws_region }}b"
40-
# DesiredScale: 2
41-
# MaxScale: 4
42-
# UseAES256Encryption: "true"
43-
# CustomerManagedCmkArn: ""
44-
# ContainerInstanceType: t3a.large
45-
# ContainerVolumeSize: 40
46-
# DatabaseAllocatedStorage: 100
47-
# DatabaseClass: db.t3.large
48-
# DatabaseEngineVersion: "12"
49-
# DatabaseParameterGroupFamily: postgres12
50-
# DatabaseMultiAZ: "false"
51-
# DatabaseUser: "{{ app_name }}_admin"
52-
# DatabasePassword: "{{ admin_database_password }}"
53-
# DatabaseName: "{{ app_name }}"
54-
# DomainName: nccopwatch.org
55-
# DomainNameAlternates: ""
56-
# AssetsCloudFrontDomain: files.nccopwatch.org
57-
# AssetsCloudFrontCertArn: arn:aws:acm:us-east-1:606178775542:certificate/379950bb-4b29-4308-8418-122674fe1076
58-
# AssetsUseCloudFront: "true"
59-
# tags:
60-
# Environment: "{{ app_name }}"
26+
cloudformation_stack_state: present
27+
cloudformation_stack_profile: '{{ aws_profile }}'
28+
cloudformation_stack_region: '{{ aws_region }}'
29+
cloudformation_stack_name: "{{ app_name }}-stack"
30+
cloudformation_stack_termination_protection: true
31+
cloudformation_stack_template_bucket: "aws-web-stacks-{{ app_name }}"
32+
cloudformation_stack_template_local_path: '{{ playbook_dir + "/stack/eks-no-nat.yml" }}'
33+
cloudformation_stack_template_parameters:
34+
PrimaryAZ: "{{ aws_region }}a"
35+
SecondaryAZ: "{{ aws_region }}b"
36+
DesiredScale: 2
37+
MaxScale: 4
38+
UseAES256Encryption: "true"
39+
CustomerManagedCmkArn: ""
40+
ContainerInstanceType: t3a.large
41+
ContainerVolumeSize: 40
42+
DatabaseAllocatedStorage: 100
43+
DatabaseClass: db.t3.large
44+
DatabaseEngineVersion: "12"
45+
DatabaseParameterGroupFamily: postgres12
46+
DatabaseMultiAZ: "false"
47+
DatabaseUser: "{{ app_name }}_admin"
48+
DatabasePassword: "{{ admin_database_password }}"
49+
DatabaseName: "{{ app_name }}"
50+
DomainName: nccopwatch.org
51+
DomainNameAlternates: ""
52+
AssetsCloudFrontDomain: files.nccopwatch.org
53+
AssetsCloudFrontCertArn: arn:aws:acm:us-east-1:606178775542:certificate/379950bb-4b29-4308-8418-122674fe1076
54+
AssetsUseCloudFront: "true"
55+
cloudformation_stack_tags:
56+
Environment: "{{ app_name }}"
6157

6258
# Install Descheduler to attempt to spread out pods again after node failures
6359
k8s_install_descheduler: yes
@@ -79,7 +75,7 @@ k8s_descheduler_release_values:
7975
# clusters for web apps.
8076
# ----------------------------------------------------------------------------
8177

82-
k8s_cluster_name: "{{ cloudformation_stack.stack_name }}-cluster"
78+
k8s_cluster_name: "{{ cloudformation_stack_name }}-cluster"
8379
k8s_context: "arn:aws:eks:us-east-2:606178775542:cluster/{{ k8s_cluster_name }}"
8480
k8s_cluster_type: aws
8581

deploy/group_vars/cdn.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
cloudfront_domain_name: "{{ k8s_domain_names[0] }}"
2+
cloudfront_domain_name_origin: "{{ env_name }}-origin.nccopwatch.org"
3+
14
cloudformation_stack_state: present
25
cloudformation_stack_profile: '{{ aws_profile }}'
36
cloudformation_stack_region: '{{ aws_region }}'
4-
cloudformation_stack_name: 'cdn-staging'
7+
cloudformation_stack_name: 'cdn-{{ env_name }}'
58
cloudformation_stack_template_bucket: 'aws-web-stacks-trafficstops'
9+
cloudformation_stack_template_bucket_path: 'templates/cdn.yml'
610
cloudformation_stack_template_local_path: '{{ playbook_dir + "/stack/cloudfront.yml" }}'
711
cloudformation_stack_template_parameters:
812
AppCloudFrontCertArn: arn:aws:acm:us-east-1:606178775542:certificate/379950bb-4b29-4308-8418-122674fe1076
913
AppCloudFrontForwardedHeaders: "Host,Authorization"
10-
DomainName: staging.nccopwatch.org
11-
AppCloudFrontOriginDomainName: staging-origin.nccopwatch.org
14+
DomainName: "{{ cloudfront_domain_name }}"
15+
AppCloudFrontOriginDomainName: "{{ cloudfront_domain_name_origin }}"
1216
# Allow key-less access to create CloudFront invalidations
1317
AppCloudFrontRoleArn: trafficstops-stack-ContainerInstanceRole-1XMBM3VLAYOVE
1418
# Required for the CloudFront template
1519
DomainNameAlternates: ""
1620
CustomAppCertificateArn: ""
1721
CertificateValidationMethod: "(none)"
1822
cloudformation_stack_tags:
19-
Environment: staging
23+
Environment: "{{ env_name }}"

deploy/inventory

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
staging
33
production
44

5+
[cdn]
6+
staging
7+
production
8+
59
[cluster]
610
aws.amazon.com ansible_connection=local ansible_python_interpreter='/usr/bin/env python3'

0 commit comments

Comments
 (0)