Increase Node Disk #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Increase Node Disk | |
on: | |
workflow_dispatch: | |
inputs: | |
network: | |
type: environment | |
description: "Whether updating a testnet or mainnet node" | |
required: true | |
aws_region: | |
description: "AWS region of EC2 instance to modify" | |
required: true | |
instance_id: | |
description: "The EC2 instance id" | |
required: true | |
disk_size: | |
description: "The amount of diskspace to add (GB)" | |
default: "50" | |
required: true | |
jobs: | |
increase-disk: | |
environment: ${{inputs.network}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Hosts Config | |
id: get-hosts | |
uses: keithweaver/aws-s3-github-action@v1.0.0 | |
with: | |
command: cp | |
source: ${{vars.S3_ANSIBLE_HOST_FILE}} | |
destination: ./ansible-hosts | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_KEY }} | |
aws_region: ${{vars.S3_REGION}} | |
- name: Run playbook | |
uses: arillso/action.playbook@master | |
with: | |
# Required, playbook filepath | |
playbook: ./scripts/ansible/aws/ec2-modify-volume-size.yml | |
inventory: ./ansible-hosts | |
galaxy_file: ./scripts/ansible/aws/requirements.yml | |
extra_vars: "aws_region=${{github.event.inputs.aws_region}} instance_id=${{inputs.instance_id}} aws_secret_key=${{secrets.AWS_SECRET_KEY}} aws_access_key_id=${{secrets.AWS_ACCESS_KEY_ID}} volume_size=${{github.event.inputs.disk_size}} ansible_python_interpreter='/usr/bin/python3'" | |
- name: Extend file system | |
id: extend-file-system | |
uses: nohmad/aws-ssm-send-command-action@master | |
with: | |
aws-region: ${{ inputs.aws_region }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
targets: | | |
[{"Key":"InstanceIds","Values":["${{ inputs.instance_id }}"]}] | |
document-name: AWS-RunShellScript | |
parameters: | | |
{"commands":["sudo growpart /dev/nvme0n1 1", "sudo resize2fs /dev/nvme0n1p1"]} | |
- name: Check SSM output | |
if: steps.extend-file-system.outcome == 'success' | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
AWS_DEFAULT_REGION: ${{ inputs.aws_region }} | |
run: | | |
aws ssm list-command-invocations --command-id "${{ steps.extend-file-system.outputs.command-id }}" --details | |