Skip to content

Instantly share code, notes, and snippets.

@lorengordon
lorengordon / gist:88e0fc8ee8f9fe312b2f
Last active November 10, 2015 21:34
Salt state to extract zip archive on Windows
{%- load_yaml as myarchive %}
name: 'C:\minionpath\to\save\my\archive.zip'
source: 'path/from/the/salt/master/to/my/archive.zip'
source_hash: 'hash_of_source_archive'
extract_dir: 'C:\minionpath\to\extract\my\archive.zip\'
{%- endload %}
# Get the zip archive
GetZipArchive:
@lorengordon
lorengordon / win_lgpo.py
Last active February 4, 2016 22:01
Salt execution module to manage local group policy via Apply_LGPO_Delta.exe
# -*- coding: utf-8 -*-
r'''
Manage Local Policy Group Policy Objects on Windows
This module uses ``Apply_LGPO_Delta.exe``, the license for which restricts it
from being distributed by a third-party application. According to Microsoft[1],
users must obtain it from the site below[2] and may then distribute it within
their own organization.
[1] https://blogs.technet.microsoft.com/fdcc/2010/03/24/sample-files-for
#cloud-config
bootcmd:
- |
/bin/bash <<-'EOS'
#!/bin/bash
exec > >(tee /root/log.txt)
exec 2>&1
set -x
set -e
if [ -e /new ]; then
packer : 2016/04/21 10:35:09 [INFO] Packer version: 0.10.0 0d4ee09ea5b0458d6e85a52ae82eb5add16bf6bb
At line:1 char:1
+ packer build .\packer-issue-3399.json *> packer-issue-3399.log
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (2016/04/21 10:3...82eb5add16bf6bb:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
2016/04/21 10:35:09 Packer Target OS/Arch: windows amd64
2016/04/21 10:35:09 Built with Go Version: go1.6
@lorengordon
lorengordon / packer-download-file.json
Last active April 26, 2016 11:58
packer-download-file-create-directory
{
"builders": [
{
"type": "amazon-ebs",
"ami_name": "packer-download-file",
"communicator": "ssh",
"instance_type": "t2.micro",
"region": "us-east-1",
"source_ami": "ami-1c221e76",
"ssh_username": "centos",
@lorengordon
lorengordon / .travis.yml
Last active August 26, 2016 10:51
Update __version__ for travis deployment to testpypi
before_deploy:
- python $TRAVIS_BUILD_DIR/ci/travis_set_build.py --file-paths '("<project>", "__init__.py")' --skip "$TRAVIS_TAG"
deploy:
- provider: pypi
server: https://testpypi.python.org/pypi
distributions: sdist
user: <username>
password:
secure: <encrypted_password>
skip_cleanup: true
@lorengordon
lorengordon / salt-development-install.txt
Last active June 30, 2017 13:24
Install salt for development on EL6/7
sudo -i
REPO="https://github.com/<your-fork>/salt"
BRANCH="<your-branch>"
# EL6
#yum -y install centos-release-SCL
#yum -y install python27 python27-python-devel python27-python-setuptools python27-python-tools python27-python-virtualenv
#yum -y --enablerepo=epel install git gcc gcc-c++ swig openssl-devel python27-python-pip
#scl enable python27 bash
@lorengordon
lorengordon / keybase.md
Created September 23, 2017 21:05
keybase.md

Keybase proof

I hereby claim:

  • I am lorengordon on github.
  • I am lorengordon (https://keybase.io/lorengordon) on keybase.
  • I have a public key ASDgBddMHCmvLj57gWIWGwjDrRCRbNjGlttM6Aw62Kkp2Qo

To claim this, I am signing this object:

@lorengordon
lorengordon / tf-build-plugins.sh
Last active November 16, 2017 14:08
Build Cross-Platform Terraform Plugins
AWS_PROVIDER_REPO=https://github.com/terraform-providers/terraform-provider-aws.git
AWS_PROVIDER_BRANCH=master
# Pre-req: Have a working go install :-)
# Get go: https://golang.org/dl/
# Install go: https://golang.org/doc/install
#curl -LO https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz
#sudo tar -C /usr/local -xvzf go*.linux-amd64.tar.gz
sudo yum -y install git
@lorengordon
lorengordon / Microsoft.PowerShell_profile.ps1
Created January 29, 2018 18:34
Powershell profile with admin check
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "Skipping functions that require elevated permissions..."
}
else
{
# Do admin stuff
}