Skip to content

Instantly share code, notes, and snippets.

View nanobeep's full-sized avatar

Matt Jaynes nanobeep

View GitHub Profile
@nanobeep
nanobeep / pcs-crmsh cheatsheet.md
Last active April 1, 2019 01:25 — forked from beekhof/pcs-crmsh cheatsheet.md
Transition guide for common crmsh commands

Also see the Pacemaker Quick Ref for a better, more complete guide.

Display the configuration

crmsh # crm configure show
pcs   # pcs cluster cib

Display the current status

crmsh # crm status

@nanobeep
nanobeep / anchore-engine-wiki.patch
Created September 15, 2017 18:54
Updates for Anchore Engine Install on Mac OS
diff --git a/Installation.md b/Installation.md
index f79b30b..cc8d0d6 100644
--- a/Installation.md
+++ b/Installation.md
@@ -14,6 +14,10 @@ Anchore Engine can be run manually, using Docker Compose, Kubernetes or any cont
mkdir -p /root/aevolume/config
+Or on Mac OS
+
@nanobeep
nanobeep / AWX.svg
Last active September 14, 2017 10:06
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Logically group the hosts
[lb]
lb.poc
[app]
app1.poc
app2.poc
# Make parent group containing all groups
# Untested!
# Rather than doing a loop, I would perhaps try this method instead...
# Put the task in an include, then call the include multiple times, but with different variables.
- include: build-and-push-docker-images.yml image=CLI
- include: build-and-push-docker-images.yml image=Deployer
- include: build-and-push-docker-images.yml image=Foo
- include: build-and-push-docker-images.yml image=Bar
# It's not beautiful, but would perhaps do what you need.
@nanobeep
nanobeep / create-ruby-package-with-fpm.sh
Created January 14, 2016 04:11
Create Ruby package with FPM
# Create Ruby package with FPM
# Do this or you'll get 404 errors from outdated package URLs
sudo apt-get update
# Need this for mkmf
sudo apt-get install -y ruby-dev
# Install dependencies (these match the dependency list in the fpm command)
sudo apt-get install -y \

(Note: I wrote this up quickly and without a lot of research, so there are probably inaccuracies. However, I wanted to put this out there in case it helps someone else hitting this issue. Github gists like this unfortunately don't have comment notifications, so if you want me to send me a comment, use my email matt@nanobeep.com and not the comments.)

Problem: Can't use sudo command-limiting in Ansible

The ability to limit sudo users to only be able to execute certain commands doesn't work with Ansible (without a workaround).

This isn't a problem if you're running Ansible as a super-user like root, but if you are allowing others to run Ansible on your systems in order to do things like application deploys, then you need a way to limit their access to the system for basic security.

For example, a line in /etc/sudoers like this:

@nanobeep
nanobeep / human_log.py
Last active August 29, 2015 14:07 — forked from steinim/human_log.py
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
if field in res.keys():
encoded_field = res[field].encode('utf-8')
print '\n{0}:\n{1}'.format(field, encoded_field)
@nanobeep
nanobeep / week-number-of-year.sh
Created August 11, 2014 17:17
Get the week number of the year.
date +%V
---
- hosts: all
tasks:
- apt_key: id=AC40B2F7 state=present url="http://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x561F9B9CAC40B2F7"
- apt: pkg=apt-transport-https state=present
- apt_repository: state=present repo='deb https://oss-binaries.phusionpassenger.com/apt/passenger raring main'
- apt: pkg=nginx-full state=present
- apt: pkg=passenger state=present update_cache=yes
- copy: src=/tmp/nginx.conf dest=/etc/nginx/nginx.conf
- service: name=nginx state=started