Skip to content

Instantly share code, notes, and snippets.

@VAdamec
VAdamec / elk-annotation.yml
Created October 2, 2018 14:35
ELK annotation in Ansible
# notifications/elk.j2
{"when_it_happened": "{{ elktimestamp.stdout }}", "title": "System", "tags": ["{{ tags }}"], "description": "{{ notification_msg }}"}
# notifications/elk-anotation.yml
- name: Timestamp for ELK
local_action: command date -u +"%Y-%m-%dT%H:%M:%S.%3NZ"
register: elktimestamp
- template:
src: notifications/elk.j2
@VAdamec
VAdamec / elk_setup.sh
Created October 2, 2018 14:31
Elastic search annotations
curl -XDELETE "http://localhost:9200/events/"
curl -XPUT localhost:9200/events -H 'Content-Type: application/json' -d '{
"settings": {
"index.number_of_shards": 2,
"index.number_of_replicas": 0
},
"mappings": {
"prod": {
"properties": {
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description>
Recover PROD full dump
</description>
<keepDependencies>false</keepDependencies>
<properties>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
consul_key_prefix.bastion-host: Modifying... (ID: demo/env/)
2017/07/21 10:56:17 [DEBUG] plugin: terraform: consul-provider (internal) 2017/07/21 10:56:17 [DEBUG] No meta timeoutkey found in Apply()
2017/07/21 10:56:17 [DEBUG] plugin: terraform: consul-provider (internal) 2017/07/21 10:56:17 [DEBUG] Setting key 'demo/env/BASTION' to 'xxx.xxx.xxx.xxx' in mydc
subkeys.%: "0" => "1"
2017/07/21 10:56:17 [DEBUG] root: eval: *terraform.EvalReadDiff
2017/07/21 10:56:17 [DEBUG] root: eval: *terraform.EvalCompareDiff
2017/07/21 10:56:17 [DEBUG] root: eval: *terraform.EvalGetProvider
subkeys.BASTION: "" => "xxx.xxx.xxx.xxx"
2017/07/21 10:56:17 [DEBUG] root: eval: *terraform.EvalReadState
2017/07/21 10:56:17 [DEBUG] root: eval: *terraform.EvalApplyPre
@VAdamec
VAdamec / terraform.py
Last active May 17, 2017 07:21
Ansible Dynamic backend for Oracle Baremetal Cloud
#!/usr/bin/env python
#
# Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
--------------------------------lb--------------------------------
version: '2'
services:
lb1:
image: rancher/lb-service-haproxy:latest
ports:
- 80:80/tcp
labels:
io.rancher.container.agent.role: environmentAdmin
version: '2'
services:
lb:
image: rancher/lb-service-haproxy:v0.6.2
stdin_open: true
tty: true
ports:
- 80:80/tcp
- 443:443/tcp
labels:
var https = require('https')
var options = {
"host": "sandbox-api.uber.com",
"path": "/v1/sandbox/requests/" + req.body.request_id,
"method": "PUT",
"headers": {
"Authorization" : "Bearer " + req.body.bearer_token,
"Content-Type" : "application/json",
}
@VAdamec
VAdamec / Makefile
Created February 23, 2017 12:00
Simle docker makefile
NAME = your-private-registry/container-name
VERSION = u0.0.4
.PHONY: all build tag_latest release
all: release
build:
sed -i.bak "s/^ENV VERSION.*/ENV VERSION $(VERSION)/g" Dockerfile
echo "VERSION=$(VERSION)" > .env
docker build -t $(NAME):$(VERSION) .
tag_latest:
docker tag $(NAME):$(VERSION) $(NAME):latest
@VAdamec
VAdamec / compose.yml
Created January 24, 2017 13:32
Selenium in Rancher
### docker-compose
version: '2'
services:
hub:
image: selenium/hub:3.0.1-fermium
environment:
GRID_BROWSER_TIMEOUT: '600000'
GRID_TIMEOUT: '600000'
ports:
- 4444:4444/tcp