Skip to content

Instantly share code, notes, and snippets.

View lanky's full-sized avatar

Stuart Sears lanky

View GitHub Profile
#!/usr/bin/env python3
import diagram
import copy
import attrdict
import yaml
from diagram.utils import dict_merge
CONFIG="""
---
# charsets and colour palettes
set -g status-utf8 on
set -g utf8 on
set -g default-shell /bin/bash
set-option -g default-command "exec /bin/bash"
set -g default-terminal screen-256color
# more obvious window splits
bind | split-window -h
bind - split-window -v
---
- name: do something that needs a virtualenv
vars:
ansible_python_interpreter: /path/to/venv/bin/python
modulename:
params: ...
---
os_repos:
- name: epel
gpgcheck: yes
baseurl: https://wibble.com/repos/epel/x86_64
gpgkey: http://wibbl.com/repos/RPM-GPG-KEY
@lanky
lanky / Ansinble-values.yml
Created July 11, 2017 13:57 — forked from ivomarino/Ansinble-values.yml
ansinble-values
conf_docker_containers:
portainer:
image: portainer/portainer
state: started
restart_policy: always
published_ports: "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- name: provision docker containers
admins:
- name: username1
pass: <redacted>
- name: username2
pass: <redacted>
home: "elephant" <-- means you'll get HOMEROOT/elephant rather that HOMEROOT/username2
admins:
- name: username
pass: <redacted>
home: "/home/username"
when: inventory_hostname == "host1"
- name: username
pass: <redacted>
home: "/newhome/username"
when: inventory_hostname != "host1"
---
# failed_when is off because you want the var to register even if there are no matching files in /etc/init.d
- name: Get startup file list
shell: grep -l kiwix-serve /etc/init.d/*
register: startup_file_list
failed_when: no
# basename gives the filename of the init script, the 'service' module will find it
- name: Stop running kiwix service
service:
---
- name: test looped include
hosts: localhost
vars:
pathnames:
- dir1
- dir2
- dir3
tasks:
- include: globit.yml
#!/usr/bin/env python
from __future__ import print_function, absolute_import, division
import os
import sys
from jinja2 import Environment, Template, FileSystemLoader
from jinja2.exceptions import TemplateSyntaxError
from argparse import ArgumentParser
import traceback
def parseargs(argv):