Skip to content

Instantly share code, notes, and snippets.

View adarobin's full-sized avatar

Adam Robinson adarobin

View GitHub Profile
@adarobin
adarobin / packer.py
Last active September 27, 2019 10:47
Packer Ansible Connection Type Plugin for Ansible 2.6.x and 2.7.x
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.connection.ssh import Connection as SSHConnection
DOCUMENTATION = '''
connection: packer
short_description: ssh based connections for powershell via packer
description:
- This connection plugin allows ansible to communicate to the target packer machines via ssh based connections for powershell.
@adarobin
adarobin / guestfs-libraries.patch
Last active May 4, 2018 20:58
libguestfs configure patch for macos
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 17cf556d9..b78a5cefa 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -181,9 +181,14 @@ PKG_CHECK_MODULES([RPC], [libtirpc], [], [
# If we don't have libtirpc, then we must have <rpc/xdr.h> and
# some library to link to in libdir.
RPC_CFLAGS=""
+ AC_CHECK_HEADER([rpc/types.h], [AC_DEFINE([HAVE_RPC_TYPES_H],
+ [], [no rpc/types.h])])
@adarobin
adarobin / tsk-rpc-types.patch
Last active May 4, 2018 23:16
tsk-rpc-types.patch
diff --git a/lib/tsk.c b/lib/tsk.c
index 09e514bd2..cb1dc94ec 100644
--- a/lib/tsk.c
+++ b/lib/tsk.c
@@ -25,8 +25,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
-#include <rpc/xdr.h>
#include <rpc/types.h>
@adarobin
adarobin / yara-rpc-types.patch
Last active May 4, 2018 23:15
yara-rpc-types.patch
diff --git a/lib/yara.c b/lib/yara.c
index edced3be8..27390d153 100644
--- a/lib/yara.c
+++ b/lib/yara.c
@@ -25,8 +25,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
-#include <rpc/xdr.h>
#include <rpc/types.h>
@adarobin
adarobin / unix_utils-c.patch
Created May 5, 2018 00:30
unix_utils-c.patch
diff --git a/common/mlutils/unix_utils-c.c b/common/mlutils/unix_utils-c.c
index 1b5eb7957..6d8aa0b6c 100644
--- a/common/mlutils/unix_utils-c.c
+++ b/common/mlutils/unix_utils-c.c
@@ -55,6 +55,10 @@
#include <windows.h>
#endif
+#ifdef __APPLE__ && __MACH__
+#include <sys/mount.h>
@adarobin
adarobin / boot.txt
Created May 8, 2018 02:18
Install Oracle VM on Hyper-V
mboot.c32 xen.gz dom0_mem=max:128G dom0_max_vcpus=20 --- vmlinuz ata_piix.prefer_ms_hyperv=0 --- initrd.img
@adarobin
adarobin / ansible-shell-local-windows.json
Last active October 9, 2022 10:34
Using the Shell-Local provisioner for Ansible against Windows with Packer
{
"type": "powershell",
"inline": [
"switch -Wildcard ($env:PACKER_BUILDER_TYPE) {",
" \"amazon*\" { $publicipv4 = Invoke-RestMethod -Method GET -Uri http://169.254.169.254/latest/meta-data/public-ipv4 }",
" \"azure*\" { $publicipv4 = Invoke-RestMethod -Method GET -Uri \"http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-12-01&format=text\" -Headers @{\"Metadata\" = \"true\"} }",
" \"googlecompute\" { $publicipv4 = Invoke-RestMethod -Method GET -Uri http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -Headers @{\"Metadata-Flavor\" = \"Google\"} }",
" Default { Throw \"Unknown PACKER_BUILDER_TYPE\" } }",
"\"[{{build_name}}]\" | Out-File C:\\Windows\\Temp\\host -encoding ascii",
"$publicipv4 | Out-File C:\\Windows\\Temp\\host -encoding ascii"
@adarobin
adarobin / tf_log.txt
Created August 9, 2019 13:42
for_each crashes on null_resource with local-exec provisioner TF_LOG
2019/08/09 09:40:06 [INFO] backend/local: apply calling Apply
2019/08/09 09:40:06 [INFO] terraform: building graph: GraphTypeApply
2019/08/09 09:40:06 [TRACE] Executing graph transform *terraform.ConfigTransformer
2019/08/09 09:40:06 [TRACE] ConfigTransformer: Starting for path:
2019/08/09 09:40:06 [TRACE] Completed graph transform *terraform.ConfigTransformer with new graph:
null_resource.test (prepare state) - *terraform.NodeApplyableResource
------
2019/08/09 09:40:06 [TRACE] Executing graph transform *terraform.DiffTransformer
2019/08/09 09:40:06 [TRACE] DiffTransformer starting
2019/08/09 09:40:06 [TRACE] DiffTransformer: found DeleteThenCreate change for null_resource.test["foo"]
@adarobin
adarobin / crash.log
Created August 9, 2019 13:45
for_each crashes on null_resource with local-exec provisioner crash.log
2019/08/09 09:40:04 [INFO] Terraform version: 0.12.6
2019/08/09 09:40:04 [INFO] Go runtime version: go1.12.7
2019/08/09 09:40:04 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2019/08/09 09:40:04 [DEBUG] Attempting to open CLI config file: /Users/adarobin/.terraformrc
2019/08/09 09:40:04 Loading CLI configuration from /Users/adarobin/.terraformrc
2019/08/09 09:40:04 [INFO] CLI command args: []string{"apply"}
2019/08/09 09:40:04 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/08/09 09:40:04 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/08/09 09:40:04 [DEBUG] New state was assigned lineage "34b35dc9-7f96-330d-ddce-e54036caabc2"
2019/08/09 09:40:04 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
variable "native_network_uri" {
type = "string"
description = "The native network of the uplink ports"
default = ""
}
variable "network_uris" {
description = "The networks trunked to the uplink ports"
type = "list"
default = []