Skip to content

Instantly share code, notes, and snippets.

View edhull's full-sized avatar
:shipit:

Ed Hull edhull

:shipit:
View GitHub Profile
@edhull
edhull / proxmox_ansible_dynamic_inventory.py
Created May 25, 2025 15:04
Python script which can be used as a dynamic inventory for Proxmox. This will group running VMs/LXC based on tags, and will attempt to connect to VMs via IPs exposed by qemu-guest-agent.
#!/usr/bin/env python3
"""
Proxmox Dynamic Inventory Script for Ansible
This script connects to a Proxmox VE API using an API token and dynamically generates
an inventory of running virtual machines and containers. Each VM is grouped by tags,
and metadata is included for Ansible use (e.g., connection type, user, IP address).
Example use: ansible-playbook main.yml -i proxmox_ansible_dynamic_inventory.py
@edhull
edhull / python_generate_presigned_s3_upload_url_webpage.py
Created August 30, 2023 13:19
Python which will generate a pre-signed S3 upload URL, and populate a static HTML page facilitating a file upload to that bucket using that pre-signed url. The policy enforces that object tagging must be present.
import boto3
import copy
from botocore.exceptions import NoCredentialsError
# Replace value with your own
bucket_name = 'bucket'
"""
Ensure your S3 bucket has the following CORS (or more restrictive)
[
@edhull
edhull / source_dest_check_disabler.py
Created February 14, 2023 15:14
Disable the source/destination check of an EC2 instance with AWS Lambda
import os
import json
import boto3
import logging
log = logging.getLogger()
log.setLevel(os.environ.get("LOG_LEVEL", "INFO"))
ec2_client = boto3.client('ec2', region_name=os.environ.get("AWS_REGION"))
ec2_resource = boto3.resource('ec2', region_name=os.environ.get("AWS_REGION"))
@edhull
edhull / restrict-aws-ecr-pull-through-cache.md
Created January 13, 2022 17:58
Restrict AWS ECR Pull-Through Cache to a limited number of upstream repositories via Registry Permission

Keybase proof

I hereby claim:

  • I am edhull on github.
  • I am edhull (https://keybase.io/edhull) on keybase.
  • I have a public key ASCjdZMCwLspgj4CmkdVYlJh3M1k9-sabHg550Tgf8onsgo

To claim this, I am signing this object: