Skip to content

Instantly share code, notes, and snippets.

@privateip
privateip / gist:879683a0172415c408fb2afb82a97511
Created April 26, 2018 19:34
how to use ansible runner programatically
import os
import json
import tempfile
import subprocess
import ansible_runner
def run():
# create an Ansible playbook as a native Python dict object. Currently
@rtulke
rtulke / markdown-to-email
Created June 12, 2018 16:32 — forked from cleverdevil/markdown-to-email
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---
@afreller-1wa
afreller-1wa / export-awx-inventory.py
Last active March 11, 2024 18:40
Updated python script to export ansible inventory from awx | ansible tower server.
#!/usr/bin/python3
import requests
import argparse
import sys
# add terms to this list which will be ignored for ini file generation.
# eg. every host var that contains ther term remote_tower will be ignored
exclude_host_vars = [ 'remote_tower']
parser = argparse.ArgumentParser(description='Convert Ansible AWX/Tower Inventory to standard inventory')