Skip to content

Commit f56b598

Browse files
authored
Support ebs encryption pr 1.x (#609)
* Adding volume encryption and type options plus a bit more flexibility on EBS control for EC2. * Setting more sane default instance sizes. * Adding more EBS options for ASGs. * Setting encryption to match AMI settings. * Setting encryption to match AMI settings. * We also need to dynamically set the ASGs own encrypt_boot var. * We need to merge the new branch changes before we can rebuild the docs. * Fixing merge command in CI. * Not sure toc.sh is actually executing. * Refactoring encrypt EBS flags to avoid detected loop condition in vars. * Safer CI, only adds .md files. * Trying to figure out CI logic for building docs. * Trying to figure out CI logic for building docs. * Trying to figure out CI logic for building docs. * Trying adding a git pull. * Setting git pull config options. * Reordering things. * Adding --allow-unrelated-histories to the git pull. * Trying a feature branch approach. * Forcing the GitHub action to fetch all git history. * Bad whitespace, naughty whitespace. * Trying a different PR action. * Do not merge the branch in, we only want the markdown changes. * Keeping the documentation branch clean. * We need to push a detached HEAD. * Do we need the checkout at all? * Adding a docs pull.
1 parent 63c7193 commit f56b598

File tree

7 files changed

+32
-19
lines changed

7 files changed

+32
-19
lines changed

.github/workflows/ce-provision-build-docs.yml

+13-10
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,36 @@ jobs:
1717
- name: Checkout code
1818
if: ${{ github.event.pull_request.head.ref != 'documentation' }}
1919
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
2022

2123
# Configures global Git variables for committing
2224
- name: Configure Git
2325
run: |
2426
git config --global user.email "sysadm@codeenigma.com"
2527
git config --global user.name "Code Enigma CI"
28+
git config --global pull.rebase false
2629
2730
# Builds the docs
2831
- name: Build documentation
29-
if: ${{ github.event.pull_request.head.ref != 'documentation' }}
32+
if: ${{ github.event.pull_request.head.ref != 'documentation' && github.event.pull_request.base.ref == '1.x' }}
3033
run: |
3134
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
3235
git fetch
33-
git checkout documentation
34-
contribute/toc.sh
35-
git add docs
36-
git add roles
37-
git diff --quiet && git diff --staged --quiet || git commit -am 'GitHub Actions - Rebuilt documentation.' && git push origin documentation
36+
/bin/sh ./contribute/toc.sh
37+
find . -name "*.md" | xargs git add
38+
git diff --quiet && git diff --staged --quiet || git commit -am 'GitHub Actions - Rebuilt documentation.'
39+
git pull origin documentation
40+
git push origin HEAD:documentation
3841
shell: bash
3942

4043
# Create docs pull request
4144
- name: Create a documentation pull request
4245
if: ${{ github.event.pull_request.head.ref != 'documentation' && github.event.pull_request.base.ref == '1.x' }}
43-
uses: devops-infra/action-pull-request@v0.4.2
46+
uses: repo-sync/pull-request@v2
4447
with:
4548
github_token: ${{ secrets.GITHUB_TOKEN }}
4649
source_branch: documentation
47-
target_branch: ${{ github.event.pull_request.base.ref }}
48-
title: Documentation update.
49-
body: "**Automated pull request** created by GitHub Actions because of a documentation update."
50+
destination_branch: ${{ github.event.pull_request.base.ref }}
51+
pr_title: Documentation update.
52+
pr_body: "**Automated pull request** created by GitHub Actions because of a documentation update."

roles/aws/aws_ami/defaults/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
aws_ami:
33
aws_profile: "{{ _aws_profile }}"
44
region: "{{ _aws_region }}"
5-
instance_type: t2.micro
5+
instance_type: t3.micro
66
virtualization_type: hvm
77
root_device_type: ebs
88
name_filter: "debian-10-amd64-*"

roles/aws/aws_ec2_autoscale_cluster/defaults/main.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ aws_ec2_autoscale_cluster:
1414
- az: c
1515
cidr_block: "10.0.3.128/26"
1616
public_subnet: public-c
17-
instance_type: t2.micro
17+
instance_type: t3.micro
1818
key_name: "{{ ce_provision.username }}@{{ ansible_hostname }}" # This needs to match your "provision" user SSH key.
1919
ami_owner: self # Default to self-created image.
20-
root_volume_size: 40
20+
root_volume_size: 30
21+
root_volume_type: gp2 # available options - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html
22+
root_volume_delete_on_termination: true
2123
ebs_optimized: true
22-
encrypt_boot: false # Whether to encrypt the EBS volumes or not.
24+
encrypt_boot: false # Whether to encrypt the EBS volumes or not, passed to the aws_ami role and to EBS volumes when instances are built
2325
ami_playbook_file: "{{ playbook_dir }}/ami.yml"
2426
ami_refresh: true # Whether to build a new AMI or not.
2527
asg_refresh: true # Whether to build a new ASG or not.
@@ -91,7 +93,7 @@ aws_ec2_autoscale_cluster:
9193
# Associated RDS instance.
9294
rds:
9395
rds: false # wether to create an instance.
94-
db_instance_class: db.m5.large
96+
db_instance_class: db.t3.medium
9597
#db_cluster_identifier: example-aurora-cluster
9698
engine: mariadb
9799
aurora_reader: false

roles/aws/aws_ec2_autoscale_cluster/tasks/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@
168168
volumes:
169169
- device_name: /dev/xvda
170170
volume_size: "{{ aws_ec2_autoscale_cluster.root_volume_size }}"
171+
volume_type: "{{ aws_ec2_autoscale_cluster.root_volume_type }}"
172+
encrypted: "{{ aws_ec2_autoscale_cluster.encrypt_boot }}"
173+
delete_on_termination: "{{ aws_ec2_autoscale_cluster.root_volume_delete_on_termination }}"
171174
register: _aws_ec2_lc_created
172175
when:
173176
- aws_ec2_autoscale_cluster.asg_refresh

roles/aws/aws_ec2_with_eip/defaults/main.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
aws_ec2_with_eip:
33
aws_profile: "{{ _aws_profile }}"
44
region: "{{ _aws_region }}"
5-
instance_type: t2.micro
5+
instance_type: t3.micro
66
key_name: "{{ ce_provision.username }}@{{ ansible_hostname }}" # This needs to match your "provision" user SSH key.
77
ami_name: "{{ _domain_name }}" # The name of an AMI image to use. Image must exists in the same region.
88
ami_owner: self # Default to self-created image.
@@ -11,10 +11,13 @@ aws_ec2_with_eip:
1111
vpc_subnet_profile: core # if you are looking up subnets we need a Profile tag to search against
1212
# An IAM Role name to associate with the instance.
1313
iam_role_name: "example"
14-
state: started
14+
state: running
1515
termination_protection: false # set to true to disable termination and avoid accidents
1616
instance_name: "{{ _domain_name }}"
1717
root_volume_size: 80
18+
root_volume_type: gp2 # available options - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html
19+
root_volume_encrypted: "{{ aws_ami.encrypt_boot }}" # in most cases this should match encrypt_boot in the aws_ami role
20+
root_volume_delete_on_termination: true
1821
ebs_optimized: true
1922
security_groups: []
2023
tags:

roles/aws/aws_ec2_with_eip/tasks/main.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@
9999
- device_name: /dev/xvda
100100
ebs:
101101
volume_size: "{{ aws_ec2_with_eip.root_volume_size }}"
102-
delete_on_termination: true
102+
delete_on_termination: "{{ aws_ec2_with_eip.root_volume_delete_on_termination }}"
103+
volume_type: "{{ aws_ec2_with_eip.root_volume_type }}"
104+
encrypted: "{{ aws_ec2_with_eip.root_volume_encrypted }}"
103105
register: aws_ec2_with_eip_instances
104106

105107
- name: Check if we have an existing EIP.

roles/aws/aws_rds/defaults/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ aws_rds:
77
- subnet-bbbbbbbb
88
name: example
99
tags: {}
10-
db_instance_class: db.m5.large
10+
db_instance_class: db.t3.medium
1111
state: present
1212
description: example
1313
engine: mariadb

0 commit comments

Comments
 (0)