Skip to content

Commit

Permalink
adding GH action for increasing disk space of an EC2 instance (#148)
Browse files Browse the repository at this point in the history
* adding GH action for increasing disk space of an EC2 instance
* pull ansible hosts file from S3
  • Loading branch information
mike-parkhill authored Dec 28, 2023
1 parent 91c92b1 commit 8b1b524
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/node-increase-disk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Increase Node Disk

on:
workflow_dispatch:
inputs:
network:
type: environment
description: "Whether updating a testnet or mainnet node"
required: true
aws_region:
description: "Location of EC2 instance to modify"
required: true
instance_name:
description: "The name of the EC2 instance"
required: true
disk_size:
description: "The total size of the disk desired"
required: true


jobs:
increase-disk:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get Hosts Config
id: get-hosts
uses: keithweaver/[email protected]
with:
command: cp
source: ${{env.S3_ANSIBLE_HOST_FILE}}
destination: ./ansible-hosts
aws_access_key_id: ${{ github.env.secret.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ github.env.secret.AWS_SECRET_KEY }}
aws_region: ${{env.S3_REGION}}

- name: Run playbook
uses: dawidd6/[email protected]
with:
# Required, playbook filepath
playbook: ec2-set-volume-size.yml
# Optional, directory where playbooks live
directory: ./scripts/ansible/aws
# Optional, additional flags to pass to ansible-playbook
options: |
--inventory ./ansible-hosts
--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}}"
3 changes: 2 additions & 1 deletion scripts/ansible/aws/ec2-set-volume-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

- name: Modify the volume
amazon.aws.ec2_vol:
profile: "{{ aws_profile }}"
aws_access_key_id: "{{ aws_key_id }}"
aws_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance: "{{ instances['instances'][0].instance_id }}"
id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}"
Expand Down

0 comments on commit 8b1b524

Please sign in to comment.