Skip to content

Instantly share code, notes, and snippets.

View steffann's full-sized avatar

Sander Steffann steffann

View GitHub Profile
@steffann
steffann / models.py
Created September 29, 2020 18:49
Implementation of storing NetBox trace paths
from django.db import models
from django.utils.translation import gettext_lazy as _
from circuits.models import CircuitTermination
from dcim.models import Cable, FrontPort, Interface, RearPort
class TraceElementQuerySet(models.QuerySet):
def _filter_or_exclude(self, negate, *args, **kwargs):
# Handle filtering on element
@steffann
steffann / rekey_vault.py
Created June 5, 2019 12:30
A simple script to re-key encrypted vault strings in Ansible
#!/usr/bin/env python
import sys
from ansible.parsing.vault import PromptVaultSecret, VaultLib
from ruamel.yaml import YAML
old_secret = PromptVaultSecret(prompt_formats=["Old password: "])
old_secret.load()
new_secret = PromptVaultSecret(prompt_formats=["New password: "])