Skip to content

Instantly share code, notes, and snippets.


Matt Martz sivel

View GitHub Profile
sivel /
Last active Jul 29, 2020
Ansible Callback to aid in replicating set_stats workflow behavior in Tower

dump_stats Ansible callback plugin

This callback plugin can aid in replicating the set_stats workflow behavior in Tower

It allows you to dump the stats set with set_stats to a file, and then use that file with --extra-vars in subsequent ansible-playbook calls.


  1. Download file to a callback_plugins directory relative to your playbook
  2. Run ansible-playbook with ANSIBLE_CALLBACK_WHITELIST=dump_stats
sivel /
Last active Sep 20, 2021
Script to create a MANIFEST.json and FILES.json for an Ansible collection from galaxy.yml
#!/usr/bin/env python
# Copyright (c) 2020 Matt Martz <>
# GNU General Public License v3.0+
# (see
import json
import os
from ansible.galaxy.collection import _build_files_manifest
from ansible.galaxy.collection import _build_manifest
# -*- coding: utf-8 -*-
# (c) 2020 Matt Martz <>
# GNU General Public License v3.0+
# (see
import argparse
import json
import re
import sys
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Ansible Project
# GNU General Public License v3.0+ (see COPYING or
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ctypes.util
import locale
sivel / 00-include_until.yml
Last active Aug 16, 2021
Ansible Include Until
View 00-include_until.yml
- hosts: localhost
gather_facts: false
- include_tasks: include_me.yml
include_max: 10


Using to_bytes/to_native/to_text


The default value for errors, although specified as None in the function signature is surrogate_then_replace

The most common and recommended values for compatibility between python2

View vmware-deploy-ovf-inject.diff
diff --git a/lib/ansible/modules/cloud/vmware/ b/lib/ansible/modules/cloud/vmware/
index 6eb690baed..0fe301a301 100644
--- a/lib/ansible/modules/cloud/vmware/
+++ b/lib/ansible/modules/cloud/vmware/
@@ -56,6 +56,12 @@ options:
default: thin
- Disk provisioning type.
+ enable_hidden_properties:
+ description:

Selective Restores on macOS

Note: This post is not yet finished

I have owned a Mac continuously for the last 8 years as part of my job and used it full time both professionally and personally. Over that time I have carried a lot of crap from machine to machine, and a lot of that was very work specific. Certs, credentials, applications, and other various configurations and files. I've always just performed a full Time Machine restore each time I upgraded.

I recently switched employers, and wanted to start mostly fresh, but with the ability to keep some of the more generic configurations on my Mac like VIM configurations, and the ability to bring over personal files. I wasn't sure how I was going to approach this at first. I imagined, that I would just take a Time Machine backup, perform a fresh install, and then use the Migration Assistant to uncheck some things I don't want.

Using the Time Machine backup and Migration Assistant, seemed like a great idea, although Migration Assistant doesn't give y

sivel / cprofile-callback.txt
Last active Jun 23, 2020
Ansible callback plugin to profile code execution via cProfile
View cprofile-callback.txt
$ ANSIBLE_CALLBACK_WHITELIST=cprofile CPROFILE_FILTERS=ansible.plugins.connection,ansible.executor.task_executor ansible-playbook -i localhosts whoami.yml
PLAY [My Cool Play] **************************************************************************************************************************************************************************************************************************
TASK [Check who I am 1] **********************************************************************************************************************************************************************************************************************
changed: [localhost0]
changed: [localhost1]
TASK [Check who I am 2] **********************************************************************************************************************************************************************************************************************
changed: [localhost0]
View 00-output.txt
vars_secret_funky_json: !vault |
"vars_secret_funky_json": {