Skip to content

Commit 8b1b524

Browse files
adding GH action for increasing disk space of an EC2 instance (#148)
* adding GH action for increasing disk space of an EC2 instance * pull ansible hosts file from S3
1 parent 91c92b1 commit 8b1b524

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Increase Node Disk
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
network:
7+
type: environment
8+
description: "Whether updating a testnet or mainnet node"
9+
required: true
10+
aws_region:
11+
description: "Location of EC2 instance to modify"
12+
required: true
13+
instance_name:
14+
description: "The name of the EC2 instance"
15+
required: true
16+
disk_size:
17+
description: "The total size of the disk desired"
18+
required: true
19+
20+
21+
jobs:
22+
increase-disk:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Get Hosts Config
29+
id: get-hosts
30+
uses: keithweaver/[email protected]
31+
with:
32+
command: cp
33+
source: ${{env.S3_ANSIBLE_HOST_FILE}}
34+
destination: ./ansible-hosts
35+
aws_access_key_id: ${{ github.env.secret.AWS_ACCESS_KEY_ID }}
36+
aws_secret_access_key: ${{ github.env.secret.AWS_SECRET_KEY }}
37+
aws_region: ${{env.S3_REGION}}
38+
39+
- name: Run playbook
40+
uses: dawidd6/[email protected]
41+
with:
42+
# Required, playbook filepath
43+
playbook: ec2-set-volume-size.yml
44+
# Optional, directory where playbooks live
45+
directory: ./scripts/ansible/aws
46+
# Optional, additional flags to pass to ansible-playbook
47+
options: |
48+
--inventory ./ansible-hosts
49+
--extra-vars aws_region="${{github.event.inputs.aws_region}}" aws_secret_key="${{github.env.secret.AWS_SECRET_KEY}}" aws_access_key_id="${{github.env.secret.AWS_ACCESS_KEY_ID}}" name="${{github.event.inputs.instance_name}}" volume_size="${{github.event.inputs.disk_size}}"

scripts/ansible/aws/ec2-set-volume-size.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
- name: Modify the volume
2121
amazon.aws.ec2_vol:
22-
profile: "{{ aws_profile }}"
22+
aws_access_key_id: "{{ aws_key_id }}"
23+
aws_access_key: "{{ aws_secret_key }}"
2324
region: "{{ aws_region }}"
2425
instance: "{{ instances['instances'][0].instance_id }}"
2526
id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}"

0 commit comments

Comments
 (0)