Skip to content

Instantly share code, notes, and snippets.

@gregswift
gregswift / ansible-authorized_key
Last active December 14, 2015 15:59
Implemented the option of providing an alternate location for a users authorized_key file. This can be useful if AuthorizedKeyFiles is changed in /etc/ssh/sshd_config
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to add authorized_keys for ssh logins.
(c) 2012, Brad Olson <brado@movedbylight.com>
This file is part of Ansible
Ansible is free software: you can redistribute it and/or modify
- vars_files:
- "vars/global_vars.yml"
- hosts: openstack-nodes
tasks:
- include: common/tasks/ssh_keys.yml user=root
- include: common/tasks/update.yml
- include: common/tasks/add_ops_repo.yml
- include: common/tasks/packages.yml
@gregswift
gregswift / wait_for_drain.py
Last active August 29, 2015 14:00
Standalone implementation of enhancement to ansible to add wait_for state=drained
import socket
import datetime
import time
import sys
import re
import binascii
HAS_PSUTIL = False
try:
import psutil

Keybase proof

I hereby claim:

  • I am gregswift on github.
  • I am gregswift (https://keybase.io/gregswift) on keybase.
  • I have a public key whose fingerprint is 3C28 7598 463B 112B B86E 4587 0700 5D32 D126 1D69

To claim this, I am signing this object:

@gregswift
gregswift / proposed
Last active August 29, 2015 14:04
playbook,s roles, and tags oh my
---
- hosts: all
vars:
- port: 8080
roles:
- { role: plight, tags: ['disable'] }
tasks:
- name: Wait for all active connections to cease
wait_for: host=0.0.0.0 port={{ port }} state=drained exclude_hosts={{ exclude_hosts }}
@gregswift
gregswift / file lists
Last active October 22, 2020 12:00
barbican rpm spec
[greg5320@laptop noarch (master %=)]$ rpm -ql openstack-barbican
/etc/barbican/barbican-admin-paste.ini
/etc/barbican/barbican-api-paste.ini
/etc/barbican/barbican-api.conf
/etc/barbican/policy.json
/etc/logrotate.d/barbican-api
/usr/bin/barbican-db-manage.py
/usr/bin/barbican.sh
/usr/lib/systemd/system/openstack-barbican-api.service
/var/log/barbican
vars:
organization:
name: My Organization
label: my_organization
locations:
- dc1
- dc2
katello_products:
- CentOS:
sync_plan: Weekly
@gregswift
gregswift / Puppetfile
Last active December 18, 2017 02:00
Sourcing puppet modules from yaml
require 'yaml'
mypath = File.expand_path(File.dirname(__FILE__))
# Load configuration from config.yml
conf = YAML::load_file("#{mypath}/Puppetfile.yml")
forge_conf = conf.fetch('forge', nil)
if forge_conf.nil?
forge = ""
@gregswift
gregswift / slackclean.py
Created August 15, 2016 16:44
Script to clean up files older than X period from Slack
#!/usr/bin/env python
# Original credit to Santiago L. Valdarrama
# http://www.shiftedup.com/2014/11/13/how-to-bulk-remove-files-from-slack
#
# Script requires SLACK_TEAM and SLACK_TOKEN to be defined in your environment.
# You can get the token from https://api.slack.com/docs/oauth-test-tokens
#
import requests
import json
import calendar
function enable-bastion() {
function ssh() {
if [[ $1 == \-v* ]]; then
VERBOSITY=${1}
TARGET=${2}
else
unset VERBOSITY
TARGET=${1}
fi
[ -z "$SSO" ] && SSO=${USER}