Skip to content

Instantly share code, notes, and snippets.

[root@kura a]# ansible-playbook -vvv -i hosts test.yml
ansible-playbook 2.9.15
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /tmp/a/hosts as it did not pass its verify_file() method
script declined parsing /tmp/a/hosts as it did not pass its verify_file() method
@timfoster
timfoster / remote_hosts.py
Created July 16, 2020 14:14
An Ansible plugin that builds an inventory from the output of 'getent hosts' on a remote machine
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import subprocess
from ansible.plugins.inventory import BaseInventoryPlugin
DOCUMENTATION = r'''
name: remote_hosts
plugin_type: inventory
@timfoster
timfoster / zol.yml
Last active August 7, 2021 09:49
Configure ZFS on Linux on a CentOS system.
#
# A series of Ansible tasks to download and configure zfs on linux
# If this is a HVM on SmartOS using one of the linux images,
# ( e.g.https://images.joyent.com/images?name=centos-7&type=zvol )
# replace the /data ext4 filesystem created by default with a zpool called
# tank, and create tank/data, mounting it to /data
#
---
- name: See if we already have the zfs source repo
@timfoster
timfoster / pargs.py
Created January 14, 2020 16:11
pargs hack to keep timf sane
#!/usr/bin/env python
# Fake up a Solaris-like pargs(1) command to keep timf sane.
# We only implement the basic functionality, and -e. Tested
# on FreeBSD 11.1-RELEASE, ubuntu 16.04.3 LTS and (uh) Solaris 11.4
# with python 2.7.13+ and 3.x. Minimal error handling here.
import os
import subprocess
import sys

Keybase proof

I hereby claim:

  • I am timfoster on github.
  • I am timsf (https://keybase.io/timsf) on keybase.
  • I have a public key ASBHPGy__XP1HmksoduC1W488DWk9_1lZZtnRnac_ByGcQo

To claim this, I am signing this object:

timf@iorangi-eth0 jr list -l vm
NAME LABELS (flat)
binder triton, public, release, tritonservice=binder, image=manta-nameservice, mg=binder, vm, manta, mantaservice=nameservice
boray manta, public, vm
electric-boray manta, public, vm
electric-moray manta, public, release, vm, mg=electric-moray, mantaservice=electric-moray, image=manta-electric-moray
mahi triton, public, release, tritonservice=mahi, image=manta-authcache, mg=mahi, vm, manta, mantaservice=authcache
manta-garbage-collector manta, public, release, vm, mantaservice=garbage-collector, mg=manta-garbage-collector, image=manta-garbage-collector
manta-madtom manta, public, release, vm, mantaservice=madtom, mg=madtom, image=manta-madtom
manta-mako manta, public, release, vm, mantaservice=storage, mg=mako, image=manta-storage
@timfoster
timfoster / smartos-pxe-menu.sh
Created May 28, 2019 14:07
A simple script to generate a pxe menu from a directory of SmartOS platform images
#!/bin/bash
DIR=/tank/archive/smartos
cd $DIR
LATEST=$(ls -1d */platform | grep -v tgz | sort -u | tail -1 | awk -F/ '{print $1}')
read -d '' HEADER << EOF
\#!ipxe
set smartos_latest $LATEST
@timfoster
timfoster / bits-upload.sh.patch
Created October 16, 2018 17:40
doing imgadm upload and saving an artifacts manifest file
timf@iorangi-eth0 (master) git diff
diff --git a/tools/bits-upload.sh b/tools/bits-upload.sh
index 8f0d77c..ca14a9d 100755
--- a/tools/bits-upload.sh
+++ b/tools/bits-upload.sh
@@ -57,6 +57,7 @@ function usage {
echo " -n <name> the name of component to upload"
echo " -N use NFS rather than manta to store artifacts"
echo " -t <timestamp> the timestamp (optional, derived otherwise)"
+ echo " -p publish bits to updates.joyent.com experimental"
[2018-10-05T13:04:42.089Z] INFO: cnapi/13347 on 4dee92d0-2580-4c54-a8e7-a381492b8968: sending task to 564d2068-a3a8-ada9-043e-faa7aa939cdf
[2018-10-05T13:04:42.103Z] INFO: cnapi/13347 on 4dee92d0-2580-4c54-a8e7-a381492b8968: task params
params: {
"server_uuid": "564d2068-a3a8-ada9-043e-faa7aa939cdf",
"uuid": "bb8f3865-5fec-4e2e-b583-a8723a21dc43",
"image": {
"v": 2,
"uuid": "1bf609cc-49c6-4486-a091-5aa9f0458712",
"owner": "930896af-bf8c-48d4-885c-6573a94b1853",
"name": "jenkins-agent-multiarch-15.4.1",