Skip to content

Instantly share code, notes, and snippets.

View OlegGorj's full-sized avatar
🎯
Focusing

Oleg Gorodnitchi OlegGorj

🎯
Focusing
View GitHub Profile
#####################
# clinet: filebeat
#####################
$cat /etc/filebeat/filebeat.yml
filebeat:
prospectors:
-
paths:
- /apphome/MetaData/log/*
@OlegGorj
OlegGorj / Ansible-Vault how-to.md
Created January 12, 2018 16:44
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

##Working with ansible-vault

I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@OlegGorj
OlegGorj / user-sudo-sudo_user-ansible.md
Created January 13, 2018 18:51
Clarification around user vs sudo vs sudo_user in ansible playbooks

Given the follwoing playbook

- hosts: all
  user: deploy
  sudo: true
  sudo_user: deploy

 tasks:
@OlegGorj
OlegGorj / clone-all-twitter-github-repos.sh
Created January 29, 2018 18:52 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'

#Ambari API - Run all Service Checks In order to check the status and stability of your cluster it makes sense to run the service checks that are included in Ambari. Usually each Ambari Service provides its own service check, but their might be services that wont include any service check at all. To run a service check you have to select the service (e.g. HDFS) in Ambari and click "Run Service Check" in the "Actions" dropdown menu.

Service Checks can be started via the Ambari API and it is also possible to start all available service checks with a single API command. To bulk run these checks it is necessary to use the same API/method that is used to trigger a rolling restart of Datanodes (request_schedules). The "request_schedules" API starts all defined commands in the specified order, its even possible to specify a pause between the commands.

Available Service Checks:

Service Name service_name Command
HDFS HDFS HDFS_SERVICE_CHECK
@OlegGorj
OlegGorj / .travis.yml
Created March 7, 2018 22:52
Terraform validates with Travis CI
language: bash
sudo: required
env:
- tf_version=0.11.3
before_install:
- wget https://releases.hashicorp.com/terraform/${tf_version}/terraform_${tf_version}_linux_amd64.zip -O /tmp/terraform.zip
- sudo unzip -d /usr/local/bin/ /tmp/terraform.zip
########################
## Variables
########################
variable "environment_name" {
description = "The name of the environment"
}
variable "vpc_id" {
description = "The ID of the VPC that the RDS cluster will be created in"
@OlegGorj
OlegGorj / ubuntu-amis.yml
Created March 8, 2018 21:19
Ubuntu 16.04.2 LTS AMIs in the regions
# Define the mappings for the Ubuntu 16.04.2 LTS in the regions
Mappings:
RegionMap:
ap-northeast-1:
ubuntu: ami-c68fc7a1
ap-northeast-2:
ubuntu: ami-93d600fd
ap-southeast-1:
ubuntu: ami-9feb5afc
@OlegGorj
OlegGorj / bastion-jumphost.tf
Created March 18, 2018 17:43
Bastion/Jumphost with TF
variable "tag" {}
variable "vpc_id" {}
variable "cidr" {}
variable "region" {}
variable "image" {}
variable "key_name" {}
variable "instance_type" {}
variable "zone_id" {}
variable "domain" {}
variable "zones" {

This is simplest way to install and run docker with TF on your local Mac. If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider.

A few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.