Skip to content

Instantly share code, notes, and snippets.

View geek182's full-sized avatar

Leandro Azevedo geek182

View GitHub Profile
@geek182
geek182 / ansible_api_playbook.py
Created November 17, 2016 19:12 — forked from viper233/ansible_api_playbook.py
Example using Ansible API 2.0 to run a playbook
#!/usr/bin/env python
# stolen from http://stackoverflow.com/questions/27590039/running-ansible-playbook-using-python-api
import os
import sys
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
@geek182
geek182 / hello_world_playbook.py
Created November 17, 2016 19:31 — forked from rm-you/hello_world_playbook.py
Ansible Playbook hello_world using Ansible 2.0 API
from ansible.cli import CLI
from ansible.executor import playbook_executor
from ansible import inventory
from ansible.parsing import dataloader
from ansible import vars
HOSTS = ['127.0.0.1']
PLAYBOOK = "/tmp/hello.yml"
REMOTE_USER = "user"
SSH_KEY = "/home/user/.ssh/id_rsa"
@geek182
geek182 / links from api info
Created December 14, 2016 15:18
aws link {API}
@geek182
geek182 / change_iam_role
Created February 20, 2017 14:40
Change IAM ROLE AWS
#Get id IAM Profile
# --profile name_of_profile, if needed
aws ec2 describe-iam-instance-profile-associations --filters "Name=instance-id,Values=i-00000000000000"
Result:
{
"IamInstanceProfileAssociations": [
{
"InstanceId": "i-000000000000000",
"State": "associated",
@geek182
geek182 / remove_openjdk.yml
Created March 2, 2017 20:14
remove openjdk
---
- name: get output
hosts: localhost
connection: local
tasks:
- name: list installed package
shell: yum list installed "java-*.*.*-openjdk.x86_64"
register: output_yum
@geek182
geek182 / boto3_hands_on.md
Created March 16, 2017 14:53 — forked from iMilnb/boto3_hands_on.md
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
-------- vars.
variable "ebs_block_device" { default = { device_name = "/dev/sdc" }
type = "map"
}
-------- main.tf
resource "aws_launch_configuration" "LaunchConfig" {
name_prefix = "lc-${var.product}-"
image_id = "${var.ami_id}"
@geek182
geek182 / nginx.conf
Created June 5, 2017 18:36 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# CREATE USER ADD ROLE
use mydb
db.createUser(
{
user: "accountUser",
pwd: "password",
roles: [ "readWrite", "dbAdmin" ]
}
)