Skip to content

Instantly share code, notes, and snippets.

View utoddl's full-sized avatar

Todd Lewis utoddl

  • U. of North Carolina at Chapel Hill
  • Chapel Hill, North Carolina, USA
View GitHub Profile
@utoddl
utoddl / test.yaml
Created February 3, 2017 19:35
Simple YAML file showing comment
---
# This is a comment.
NoComments:
aa: "Not # a # comment."
bb: Also#not a comment.
cc: Also# not a comment.
dd: ' # not a comment '
Comments:
dd: This #ends with a comment.
ee: This also # ends with a comment.
@utoddl
utoddl / jsfgenerate.pl
Last active November 14, 2019 19:39
generate files to test / demonstrate .jsf colors
#!/usr/bin/perl -w
# generate files to test .jsf colors.
# (c) 2019 [email protected]
# GPL
use strict;
syntax() if @ARGV;
sub syntax {
print qq[Usage: $0
@utoddl
utoddl / polymac.py
Last active February 3, 2022 16:19
Ansible filter module for expanding dicts with variable substitutions
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Todd M. Lewis <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
DOCUMENTATION = """
lookup: polymac
@utoddl
utoddl / av-filter
Last active July 31, 2024 18:52
Filter for "ansible-vault"ing YAML Data Values
#!/usr/bin/env python
"""Filter for "ansible-vault"ing YAML Data Values
https://gist.github.com/utoddl/66baa4154618ba1fc8ec8127483e7e89
This script allows an ansible user to pass lines of yaml data
through it to get string values vaulted and/or already-vaulted values
unvaulted, thus simplifying the maintenance of vaulted strings in
Ansible vars files and eliminating the need to vault entire files.
@utoddl
utoddl / mergevars.py
Created September 16, 2023 01:21
Merge ansible variables listed by name and/or matching regular expression.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.plugins.filter.core import flatten
from ansible.module_utils.six import string_types
@utoddl
utoddl / ansible-cfg2env
Created November 23, 2023 13:50
converts ansible.cfg settings to shell environment variables
#!/bin/env python3
import os
import re
import yaml
import ast
import pprint
import configparser
import subprocess
import argparse