Skip to content

Instantly share code, notes, and snippets.

View canit00's full-sized avatar
🖥️
01101100 01100101 01100001 01110010 01101110 01101001 01101110 01100111

canit00

🖥️
01101100 01100101 01100001 01110010 01101110 01101001 01101110 01100111
  • U.S.
View GitHub Profile
@canit00
canit00 / pedantically_commented_playbook.yml
Created November 9, 2017 20:13 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@canit00
canit00 / ansible-summary.md
Created November 10, 2017 00:13 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@canit00
canit00 / jinja-example-iteritems.py
Created September 22, 2018 18:15 — forked from wunzeco/jinja-example-iteritems.py
jinja-example-iteritems
#!/usr/bin/env/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from jinja2 import Environment
alphabets = {"a": "Apple", "b": "Butterfly", "c": "Car"}
title = "ABC tutorial"
@canit00
canit00 / in.j2
Created September 27, 2018 21:22 — forked from jhriv/in.j2
Sample Ansible Playbook template+iteritems
The following should be:
SAMPLE:
one -> first
two -> second
three -> third
ACTUAL:
{% for k, v in d.iteritems() %}
{{ k }} -> {{ v }}
@canit00
canit00 / openssl_commands.md
Created September 29, 2018 20:48 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@canit00
canit00 / opt1_template.j2
Created October 12, 2018 13:44 — forked from halberom/opt1_template.j2
ansible - example of template if else
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}
@canit00
canit00 / pyscript.py
Created October 21, 2018 15:42 — forked from nhoffman/pyscript.py
Python script template
#!/usr/bin/env python
"""A simple python script template.
"""
from __future__ import print_function
import os
import sys
import argparse
@canit00
canit00 / openshift_cli_tricks.MD
Created November 5, 2018 17:42 — forked from tuxfight3r/openshift_cli_tricks.MD
openshift cli tricks - using go templates

openshift list all pods and thier specs (requests/limits)

oc get pod -o jsonpath='{range .items[*]}{"SPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}'

openshift list all pods and thier specs with name (requests /limits)

oc get pod -o jsonpath='{range .items[*]}{"NAME:  "}{.metadata.name}{"\nSPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n\n"}{end}'
@canit00
canit00 / kubectl.md
Created November 5, 2018 19:35 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@canit00
canit00 / Ansible Disk Check
Created November 10, 2018 02:52 — forked from alexanderadam/Ansible Disk Check
Show disk space and warn about disk full in Ansible
* Shows a message while asserting like:
ok: [host] => {
"msg": "disk usage 4.2B of total 20.0GB (21.0%) (should exceed limit 90.0%)"
}
* Note this only looks at first mount point on current node
* Fails if disk is near-full
* Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time
* Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size