Skip to content

Instantly share code, notes, and snippets.

View sudheerchamarthi's full-sized avatar

Sudheer Chamarthi sudheerchamarthi

View GitHub Profile
- name: Remove a file, if present
win_file:
path: C:\Temp\foo.conf
state: absent
@sudheerchamarthi
sudheerchamarthi / Ansible Email
Created May 24, 2017 10:08
This Ansible is to Send an email using Google SMTP credentials
###############################################################
############### PREREQUISITE #################################
## Make Sure that "Access for less secure apps has been turned on" in you Gmail account by following the below link
## LINK: https://myaccount.google.com/lesssecureapps
## If Not your email will not be delivered and you will recieve a Warning Notifcation like "Review blocked sign-in attempt"
---
- name: Sending email
mail:
host: smtp.gmail.com
READ BELOW DOCS BY NEXT CLASSSSSSSSSSSSSSSSSSS
Installation - http://docs.ansible.com/ansible/latest/intro_installation.html#latest-release-via-yum
Inventory - http://docs.ansible.com/ansible/latest/intro_inventory.html
adhhoc commands - http://docs.ansible.com/ansible/latest/intro_adhoc.html
22-07-2017
import boto3
import time
import datetime
print "Function Start Time: "+ str(datetime.datetime.now())
Region='us-east-1'
ASG_Name='awseb-e-3rreanw3r3-stack-AWSEBAutoScalingGroup-C20XEFG034MN'
Draining_Time='20'
ELB_Name='awseb-e-3-AWSEBLoa-PPG010DUGCPK'
ASG_Instance_Count=3
asg_client = boto3.client('autoscaling',region_name=Region)
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y --enablerepo=epel php-mcrypt
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE+62qMDTvS1YYy4CRshoReFUV/CHYpa5nxsZdDlSxcK0BJo3++qUG0EGEsADvXur9EWRF0n0mFMxyqh/KbdYWFpLUf/O7u5GDamnPmGdtD/tzkoDln31uem+bKTgEqGAnz9jEHa6d4Ar5nO0C+h4wt0zHvGvEvyStqreikNxp8bBzNSAaRg/CMG+9EmZNs6U+w1aRWBIz/t1Q8QcPcifFF/Nw54+dZN+VBIqscu0ka5+DFg61xEFuuGXWEdJtQzYdcPNIgOWfnQfr4yH+wxUGg+yjqEdVpWMfTrY3ZafZYG6FmN5lqGFFs2hhwJMOdQtgito9fL4VHPJNm9bcB9uv [email protected]
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"BucketPrefix": {
"Type": "String",
"Default": "test-bucket-name"
},
"LambdaFunctionName": {
"Type": "String",
"Default": "test-function-name"
resource "aws_security_group_rule" "ELBIngressRule" {
type = "ingress"
from_port = 0
to_port = 65535
protocol = "-1"
# Allow all traffic from ALB to workerNodes
source_security_group_id = "${var.elb_security_group}"
security_group_id = "${aws_security_group.NodeSecurityGroup.id}"
}
import boto3
import re
import requests
from requests_aws4auth import AWS4Auth
region = 'us-east-1'
service = 'es'
credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)
host='XXXXXX'
RoleArn = 'arn:aws:iam::XXXX:role/cross-account-role'