Skip to content

Instantly share code, notes, and snippets.

View darKoram's full-sized avatar

darKoram darKoram

View GitHub Profile
init_config:
# Change the root directory to look at to get cgroup statistics. Useful when running inside a
# container with host directories mounted on a different folder. Default: /.
# Example for the docker-dd-agent container:
# docker_root: /host
docker_root: /
# Timeout on Docker socket connection. You may have to increase it if you have many containers.
@darKoram
darKoram / cli.py
Created December 1, 2014 20:34
pass json dict-as-string commandline args to functions or methods in a files
import os
# based on
# http://code.activestate.com/recipes/577122-transform-command-line-arguments-to-args-and-kwarg/
def _method_info_from_argv(argv=None):
"""Command-line -> method call arg processing.
- positional args:
a b -> method('a', 'b')
@darKoram
darKoram / playbook
Created September 24, 2014 18:46
getting dictionaries templated without u" prefix
The goal is to define a dictionary like
dict1:
int1: 5
str1: "four"
and be able to template output the dictionary as a whole (not leaf by leaf) such that the output looks like
dict1: {"int1": 5, "srt1": "four"}
@darKoram
darKoram / README
Last active August 29, 2015 14:05
test ansible force_handlers
I'd like to force handlers to run even if a host fails on a task. Sort of like a tearDown() in a test harness.
@darKoram
darKoram / dict_from_list_adaptor
Created June 27, 2014 18:11
Unfinished: dict_from_list_adaptor to convert easily from a list to a dict related to https://groups.google.com/forum/#!msg/ansible-project/TYbORkOM6Dw/5lusNmTIDzUJ
from collections import Counter
def dict_from_list_adaptor(key, _list, key_name=None, results_names=None, find_first=False):
'''Given a list-flattened dict, do a key value retrieval
Imagine a dictionary where every entry was {word: dictword, def: ditdef} instead of {dictword: dictdef}
eg. list_flattened_dict=[{word: apple, def: 'fruit...', noun: True},{word: ape, def: 'mamal of genus...', noun: True}]
We have to loop over entries in order to extract the definition turning a constant time
hash lookup of a dict into a linear time array scan for a list.
Basically, our data is stored in the wrong datastructure and we need an adaptor.
@darKoram
darKoram / Discussion on custom vars_plugin precedence
Last active August 29, 2015 14:01
Exploring Ansible Variables Precedence with hash_behavior = merge A series of experiments was perfomed by defining overlapping dicts in the following files. The integer is to verify that the item was loaded regardless of precedence. Files are given relative to the root ansible-project directory with slashes replaced by spaces.
According to the ansible docs
http://docs.ansible.com/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
The precedence should be
* -e variables always win (yes)
* then comes "most everything else"
* then comes variables defined in inventory (not tested - hosts vars)
* then comes facts discovered about a system (not tested - gather_facts )
* then "role defaults", which are the most "defaulty" and lose in priority to everything. (no)
@darKoram
darKoram / ambari-server.log
Last active August 29, 2015 13:56
Ambari restart-services give-bash: /usr/lib/hadoop/bin/hadoop-daemon.sh: Permission denied <br> An 11 node virtualized hdfs stack was set up using ambari 1.3.2 . Setup was successful. I then wanted to shutdown the cluster to add ceph as a backend storage. On restart I get permission denied errors on the daemons, jobtracker datanode etc. I don't …
via grep, the only error I see is JMX metrics
05:29:17,335 ERROR [pool-3-thread-98] JMXPropertyProvider:469 - Caught exception getting JMX metrics : Connection refused
05:29:17,553 INFO [qtp936154025-338] HeartBeatHandler:113 - Received heartbeat from host, hostname=txoig-stag-elastic02.tx1.21ct.com, currentResponseId=694, receivedResponseId=694
05:29:17,554 INFO [qtp936154025-338] AgentResource:109 - Sending heartbeat response with response id 695
05:29:17,569 ERROR [pool-3-thread-90] JMXPropertyProvider:469 - Caught exception getting JMX metrics : Connection refused
05:29:18,292 INFO [qtp936154025-340] HeartBeatHandler:113 - Received heartbeat from host, hostname=txoig-stag-zoo02.tx1.21ct.com, currentResponseId=756, receivedResponseId=756
05:29:18,293 INFO [qtp936154025-340] AgentResource:109 - Sending heartbeat response with response id 757
05:29:20,780 ERROR [pool-3-thread-96] JMXPropertyProvider:469 - Caught exception getting JMX metrics : Connection refused
05:29:20,783 ERROR [pool-3-thread-22] JMXP
@darKoram
darKoram / brew --config
Created February 16, 2014 19:13
brew install meld
[kbroughton@mb-kbroughton:proto/lynx-ansible + (develop)] brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 5c1feb6773bc9e3c580fae8f65cce74c01bb5569
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9.1-x86_64
Xcode: 5.0.2
CLT: 5.0.1.0.1.1382131676
@darKoram
darKoram / assign_static_ips.yml
Last active December 27, 2015 12:59
Re map dynamic ips to static ips for vms hosted on vsphere.
# Requires pysphere (pip install -U pysphere) and python-nmap
# Requires argparse (standard lib for python 2.7)
# This assumes you have the names of your new vms, but not the ips that were dhcp'd.
# It also assumes you have a pool of static ips to select from, some of which may already be taken.
# static_network_ips.py takes a subnet range and scans for free ips.
# remap_interfaces.py takes a dict object and fills in the static ips.
# To remap, you will need a dict with the dynamic ips associated with the names.
@darKoram
darKoram / output_ssh-copy-id
Last active December 27, 2015 00:09
ssh password strategy for populating known_hosts so remote hosts can access each other. This assumes we already have an ansible controller with paswordless loging from it to each remote host. We are trying to add passwordless logins BETWEEN the remote hosts.
OUTPUT1
TASK: [Set up passwordless ssh between nodes] *********************************
failed: [Ubuntu-Cluster-02] => (item=Ubuntu-Cluster-01) => {"changed": true, "cmd": ["ssh-copy-id", "accumulo@Ubuntu-Cluster-01"], "delta": "0:00:00.005403", "end": "2013-10-30 11:13:56.342835", "item": "Ubuntu-Cluster-01", "rc": 1, "start": "2013-10-30 11:13:56.337432"}
failed: [Ubuntu-Cluster-05] => (item=Ubuntu-Cluster-01) => {"changed": true, "cmd": ["ssh-copy-id", "accumulo@Ubuntu-Cluster-01"], "delta": "0:00:00.004475", "end": "2013-10-30 11:13:56.495424", "item": "Ubuntu-Cluster-01", "rc": 1, "start": "2013-10-30 11:13:56.490949"}
stderr: /usr/bin/ssh-copy-id: ERROR: No identities found
stderr: /usr/bin/ssh-copy-id: ERROR: No identities found
----------