Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
--- | |
# ^^^ 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. |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
#!/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" |
The following should be: | |
SAMPLE: | |
one -> first | |
two -> second | |
three -> third | |
ACTUAL: | |
{% for k, v in d.iteritems() %} | |
{{ k }} -> {{ v }} |
{# 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 %} |
#!/usr/bin/env python | |
"""A simple python script template. | |
""" | |
from __future__ import print_function | |
import os | |
import sys | |
import argparse |
oc get pod -o jsonpath='{range .items[*]}{"SPEC: \n LIMITS : "}{.spec.containers[*].resources.limits}{"\n REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}'
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}'
* 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 |