Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b8b5496
wait for ebs volume modification to end
mike-parkhill Feb 28, 2024
23bffce
fix yaml formatting
mike-parkhill Feb 28, 2024
73126de
remove check
mike-parkhill Feb 28, 2024
32ff9bd
fix var names in new code
mike-parkhill Feb 28, 2024
1d305b4
increase delay on volume modification check
mike-parkhill Apr 1, 2024
b56d23e
increase ansible verbosity
mike-parkhill Apr 3, 2024
986fbe0
make delay 5 minutes
mike-parkhill Apr 18, 2024
d85d8d2
switch to simple sleep
mike-parkhill Apr 18, 2024
12f9231
tweak ssm output command
mike-parkhill Apr 23, 2024
9fdbf20
attempt to fix SSM output check using jq
mike-parkhill Feb 7, 2025
c9ad15d
Fix action palybook branch.
gasher Sep 9, 2025
034912e
temp: disable playbook for size increase.
gasher Sep 9, 2025
c1cb3a6
temp: add smm healthcheck.
gasher Sep 9, 2025
296ea96
Revert temps.
gasher Sep 9, 2025
e5fac84
Fix missing packaging python.
gasher Oct 27, 2025
e85e6af
Fix missing packaging python.
gasher Oct 27, 2025
bb7acae
Fix missing packaging python.
gasher Oct 27, 2025
f16d59d
Fix missing packaging python.
gasher Oct 27, 2025
da0f200
Fix missing packaging python.
gasher Oct 27, 2025
c27a93d
Fix missing packaging python.
gasher Oct 27, 2025
74e93db
Fix missing packaging python.
gasher Oct 27, 2025
788bf44
Fix missing packaging python.
gasher Oct 27, 2025
152f339
Debug.
gasher Oct 27, 2025
d594e41
Debug.
gasher Oct 27, 2025
cf6bf04
Debug.
gasher Oct 27, 2025
7c774cb
Debug.
gasher Oct 28, 2025
64065c0
Debug.
gasher Oct 28, 2025
57a9258
Debug.
gasher Oct 28, 2025
f3c9def
Remove debug.
gasher Oct 28, 2025
2ea7944
Merge branch 'master' into bug/node-size-failures
gasher Oct 28, 2025
d090774
Fix error check.
gasher Oct 29, 2025
22c002d
Parametrize node-increase-disk.
gasher Oct 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 58 additions & 11 deletions .github/workflows/node-increase-disk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,28 @@ on:
description: "The amount of diskspace to add (GB)"
default: "50"
required: true
disk:
description: "The disk to increase using growpart (e.g., /dev/xvda)"
default: "/dev/xvda"
required: true
partition_number:
description: "The partition number to extend using growpart (e.g., 1)"
default: "1"
required: true
partition_device:
description: "The partition device to extend using resize2fs (e.g., /dev/xvda1)"
default: "/dev/xvda1"
required: true


jobs:
increase-disk:
environment: ${{inputs.network}}
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get install -y jq

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -39,14 +54,31 @@ jobs:
aws_secret_access_key: ${{ secrets.AWS_SECRET_KEY }}
aws_region: ${{vars.S3_REGION}}

- name: Run playbook
uses: arillso/action.playbook@master
- uses: actions/setup-python@v5
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'"
python-version: '3.11'

- name: Install Ansible + deps
run: |
python -m pip install --upgrade pip
pip install "ansible-core>=2.16" boto3 botocore packaging

- name: Galaxy install
run: ansible-galaxy install -r ./scripts/ansible/aws/requirements.yml

- name: Run playbook
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
run: |
ansible-playbook \
-i ./ansible-hosts \
--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'" \
./scripts/ansible/aws/ec2-modify-volume-size.yml

- name: Wait for AWS to finish provisioning the disk
run: sleep 30m
shell: bash

- name: Extend file system
id: extend-file-system
Expand All @@ -59,14 +91,29 @@ jobs:
[{"Key":"InstanceIds","Values":["${{ inputs.instance_id }}"]}]
document-name: AWS-RunShellScript
parameters: |
{"commands":["sudo growpart /dev/nvme0n1 1", "sudo resize2fs /dev/nvme0n1p1"]}
{
"commands":[
"sudo growpart ${{ inputs.disk }} ${{ inputs.partition_number }}",
"sudo resize2fs ${{ inputs.partition_device }}"
]
}

- name: Check SSM output
if: steps.extend-file-system.outcome == 'success'
- name: Get SSM output
if: always()
id: get-ssm-output
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
COMMAND_OUTPUT=$(aws ssm list-command-invocations --command-id ${{ steps.extend-file-system.outputs.command-id }} --details | jq -c .)
echo "COMMAND_OUTPUT=$COMMAND_OUTPUT" >> $GITHUB_ENV

- name: Check SSM output
if: steps.get-ssm-output.outcome == 'success' && !contains(env.COMMAND_OUTPUT, 'Status:Success')
run: |
echo "Error detected trying to extend the partition."
echo ${{env.COMMAND_OUTPUT}}
exit 1


86 changes: 43 additions & 43 deletions scripts/ansible/aws/ec2-modify-volume-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,49 @@
volume_type_default: "{{ volume_type | default('io1') }}"

pre_tasks:
- name: Install dependencies
pip: name={{ item }}
with_items:
- boto3
- botocore
- name: Install dependencies
pip: name={{ item }}
with_items:
- boto3
- botocore

tasks:

- name: Get EC2 instance state
amazon.aws.ec2_instance:
aws_access_key_id: "{{ aws_access_key_id }}"
aws_secret_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance_ids: [ "{{instance_id}}" ]
register: instances

- name: EC2 instance info
ansible.builtin.debug:
msg: Instance ID {{ instances['instances'][0].instance_id }}, root volume {{ instances['instances'][0].block_device_mappings[0].ebs }}

- name: Get current volume info
amazon.aws.ec2_vol:
aws_access_key_id: "{{ aws_access_key_id }}"
aws_secret_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance: "{{ instance_id }}"
id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}"
modify_volume: false
register: volume_info

- name: EC2 volume info
ansible.builtin.debug:
msg: Volume ID {{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}, Old size {{ volume_info.volume.size }}, New size {{ volume_info.volume.size|int + volume_size|int }}

- name: Modify the volume
amazon.aws.ec2_vol:
aws_access_key_id: "{{ aws_access_key_id }}"
aws_secret_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance: "{{ instance_id }}"
id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}"
volume_size: "{{ volume_info.volume.size|int + volume_size|int }}"
volume_type: "{{ volume_type_default }}"
iops: "{{ iops | default(1300) if volume_type_default is regex('^io*') else omit }}"
modify_volume: true
- name: Get EC2 instance state
amazon.aws.ec2_instance:
aws_access_key_id: "{{ aws_access_key_id }}"
aws_secret_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance_ids: [ "{{instance_id}}" ]
register: instances

- name: EC2 instance info
ansible.builtin.debug:
msg: Instance ID {{ instances['instances'][0].instance_id }}, root volume {{ instances['instances'][0].block_device_mappings[0].ebs }}

- name: Get current volume info
amazon.aws.ec2_vol:
aws_access_key_id: "{{ aws_access_key_id }}"
aws_secret_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance: "{{ instance_id }}"
id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}"
modify_volume: false
register: volume_info

- name: EC2 volume info
ansible.builtin.debug:
msg: Volume ID {{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}, Old size {{ volume_info.volume.size }}, New size {{ volume_info.volume.size|int + volume_size|int }}

- name: Modify the volume
amazon.aws.ec2_vol:
aws_access_key_id: "{{ aws_access_key_id }}"
aws_secret_access_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
instance: "{{ instance_id }}"
id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}"
volume_size: "{{ volume_info.volume.size|int + volume_size|int }}"
volume_type: "{{ volume_type_default }}"
iops: "{{ iops | default(1300) if volume_type_default is regex('^io*') else omit }}"
modify_volume: true


Loading