Skip to content

Instantly share code, notes, and snippets.

View darKoram's full-sized avatar

darKoram darKoram

View GitHub Profile
@darKoram
darKoram / main.yml
Created October 14, 2013 20:46
Demonstrate the unsuitable YAML syntax error when there is a space before "---" leading a vars/main.yml file
---
# note the space before the ---
var1: "val"
# PRODUCES ERROR MESSAGE
# ansible-playbook -i hosts playbooks/test2.yml --limit=localhost
# [' var1', ' "val"']
# ERROR: Syntax Error while loading YAML script, /Users/kbroughton/vcp/git/21ct/proto/lynx-ansible/vars/main.yml
# Note: The error may actually appear before this position: line 3, column 6
@darKoram
darKoram / .ansible.cfg
Created October 15, 2013 15:52
accessing .ansible.cfg variables in jinja2 templates I don't understand why ansible_managed works and hostfile doesn't.
hostfile = /etc/ansible/hosts
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
@darKoram
darKoram / hosts
Created October 17, 2013 20:35
Problem with running ./site.sh for ansible-hadoop from analytically.
# Kesten Ansible managed: accumulo/templates/accumulo_hosts.j2 modified on 2013-10-14 14:58:02 by kbroughton on mb-kbroughton.local
# Hadoop Nodes
# ============
[zookeepers] # minimal 3, must be odd number of servers
Ubuntu_Cluster_02 zoo_id=2
Ubuntu_Cluster_03 zoo_id=3
Ubuntu_Cluster_04 zoo_id=4
@darKoram
darKoram / main.yml
Created October 21, 2013 03:50
--start-at-task does not work with group-by groups, at least not for group-by ansible_os_family If hosts is one dynamically generated by group-by, --start-at-task="common | Task1" will skip all tasks. if hosts is changed to something in hosts file, start-at-task works.
---
# roles/common/tasks/main.yml
- name: Task1
command: echo task1
- name: Task2
command: echo task2
@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
----------
@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 / 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 / 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 / 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 / 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.