Skip to content

Instantly share code, notes, and snippets.

@jmlrt
jmlrt / manage-es-token.js
Last active November 9, 2022 16:55
Node JS script to create an Elasticsearch token for Kibana and register it as a K8S secret
const https = require('https');
const fs = require('fs');
// Read environment variables
function getEnvVar(name) {
if (name in process.env) {
return process.env[name]
} else {
throw new Error(name + ' environment variable is missing')
}
@jmlrt
jmlrt / .kitchen.yml
Last active September 4, 2019 20:44
deploy elasticsearch in docker container using kitchen-ci and ansible
---
driver:
name: docker
provisioner:
name: ansible_playbook
hosts: localhost
require_ansible_repo: true
ansible_verbose: true
ansible_version: latest
@jmlrt
jmlrt / ubuntu-laptop.yml
Created May 24, 2019 11:07
Old playbook to setup ubuntu laptop
---
- hosts: localhost
vars:
pkg_docker_prerequisites:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
@jmlrt
jmlrt / packer-vagrant.json
Created March 7, 2019 10:58
Vagrant box creation using Packer
{
"builders": [{
"type": "vagrant",
"source_path": "centos/7",
"box_name": "test",
"provider": "virtualbox",
"communicator": "ssh",
"ssh_port": 22,
"ssh_username": "vagrant",
"skip_add": true
@jmlrt
jmlrt / README.md
Last active February 21, 2019 11:11
MongoDB RS provisioning with Vagrant & Ansible

MONGODB RS CONFIGURATION WITH SECURITY ENABLED

Simply run vagrant up and the 3 mongo instances will be deployed and register in replica set

@jmlrt
jmlrt / Makefile
Last active March 14, 2022 23:01
docker instance quick provisioning
.PHONY : provisioning destroy
SHELL := /bin/bash
# Default commands for Ansible and Terraform using Docker containers
# To use local Ansible and Terraform binaries: make all ANSIBLE_CMD=ansible-playbook TERRAFORM_CMD=terraform
ANSIBLE_CMD := docker run --rm --env="USER_ID=$(shell id -u)" --volume $(shell pwd):/tmp --workdir /tmp ansible/ansible:latest ansible-playbook
TERRAFORM_CMD := docker run --rm --user $(shell id -u) --volume $(shell pwd):/root --workdir /root/ hashicorp/terraform:0.11.11
# Default region used to launch EC2 instance
region := us-east-1
@jmlrt
jmlrt / aws-helpers.sh
Created December 13, 2018 10:32
AWS Helpers functions
# AWS Helpers functions
#
# prerequisites:
# - awscli
# - jq
# parse aws arn
parse_arn() {
echo $1 | sed 's/\"//g;s/^.*\///'
}
@jmlrt
jmlrt / main.tf
Created December 7, 2018 14:00
ECS Fargate sample topology
provider "aws" {
region = "${var.region}"
}
resource "aws_ecs_cluster" "ecs_cluster" {
name = "${var.cluster_name}"
}
resource "aws_ecs_task_definition" "task" {
family = "${var.service_name}"
@jmlrt
jmlrt / nginx.conf
Created August 17, 2018 14:18
Default Nginx config for Gateway with HTTPS
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://gateway:8080;
}
}
server {
@jmlrt
jmlrt / playbook_cf_stack_update.yml
Created May 3, 2018 15:28
Ansible Cloudformation Stack Update
# playbook_cf_stack_update.yml
# update an existing cloudformation stack by changing only the parameters specified into updated_params dict variable
- hosts: localhost
connection: local
gather_facts: False
vars:
stack_name: stack-to-update