Instantly share code, notes, and snippets.

View profile-preinstall-check
# preflight to check for profile installed by Jamf
# Get logged in user
loggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
#loggedInUID=$(id -u "$loggedInUser")
# First, see if the profile is there
#!/usr/bin/env python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or
# This script can create an Ansible Dynamic Inventory with either:
# - the FreeIPA API over HTTPS with the `python_freeipa` module
# - using kerberos authentication with the `ipalib` and `ipaclient` module
# DEPENDENCIES: before this script will work the python_freeipa or ipalib module has to be installed
# For Ansible AWX or Tower add this to your Docker image
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Red Hat, Inc.
# This file is part of Ansible
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
View awx custom credential notes
for freeipa source credential:
input config (yaml)
- type: string
id: fipahttps
label: HTTPS
default: True
- type: string
id: fipaserver
JSS + Ansible inventory
A dictionary of lists of computers by group name.
Heavily influenced by
with help from
I'd really like to avoid caching, as any sort of timeout won't be appropriate since I
View gist:abbbc6e18b5f71e53ffa5c2d39231388
import sys, os
import urllib, urllib2
import base64
import json
import requests
import xml.etree.ElementTree as ET
def requests_xml(jss_user, jss_pass, jss_url, category):
# update a patch
echo -n "Enter an app name: "
read -e APP_NAME
echo -n "Enter a Publisher name (blank to match App Name): "
[devyn@ipa ~]$ ipa help commands
automember-add                         Add an automember rule.
automember-add-condition               Add conditions to an automember rule.
automember-default-group-remove        Remove default (fallback) group for all unmatched entries.
automember-default-group-set           Set default (fallback) group for all unmatched entries.
automember-default-group-show          Display information about the default (fallback) automember groups.
automember-del                         Delete an automember rule.
automember-find                        Search for automember rules.
automember-mod                         Modify an automember rule.
#!/usr/bin/env python
import argparse
import json
from ipalib import api
def initialize():
This function initializes the FreeIPA/IPA API. This function requires
#!/usr/bin/env python
Check version of app installed using CFBundleVersion
import os
import CoreFoundation
app = "Utilities/" # Assumes '/Applications/'