Skip to content

Instantly share code, notes, and snippets.

View VireshDoshi's full-sized avatar
💭
working

Viresh Doshi VireshDoshi

💭
working
  • London
View GitHub Profile
@VireshDoshi
VireshDoshi / Jenkinsfile.groovy
Last active February 26, 2018 09:37
Jenkins Pipeline script to build the AMI image and push to AWS
pipeline {
agent {
docker {
image 'vireshdoshi/jen-build-node-app-aws:latest'
}
}
stages {
stage('Checkout and Build') {
steps {
sh 'git clone https://github.com/VireshDoshi/node-app .'
@VireshDoshi
VireshDoshi / main.tf
Created February 26, 2018 09:32
Terraform script to build out the AWS environment for a node app
variable "access_key" {}
variable "secret_key" {}
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "us-east-1"
}
data "aws_ami" "node_app_ami" {
@VireshDoshi
VireshDoshi / ansible-playbook.yml
Created February 26, 2018 09:31
ansible playbook used by packer AMI provisioner creation
---
- hosts: all
tasks:
- name: Install the gpg key for nodejs LTS
become: true
apt_key:
url: "http://deb.nodesource.com/gpgkey/nodesource.gpg.key"
state: present
@VireshDoshi
VireshDoshi / packer.json
Created February 26, 2018 09:23
packer file for creating an AMI image with ansible provisioning
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'ubuntu' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
@VireshDoshi
VireshDoshi / terraform-project.text
Created February 26, 2018 09:13
terraform project structure
terraform_project/
--> autoscaling_groups/
--> variables.tf
--> website-asg.tf
--> launch_configurations/
--> variables.tf
@VireshDoshi
VireshDoshi / test_selenium_grid.py
Created February 22, 2018 10:12
one page selenium grid python script
[vdo023@localhost ASOS_BDD_WebTester]$ cat ./test_selenium_grid.py
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
class PythonOrgSearch(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(
[vdo023@localhost modify_list]$ ansible-playbook -i "localhost," ./modify_list-playbook.yml
PLAY [localhost] **********************************************************************************************************************************
TASK [modify the list values by appending to the end with _changed] *******************************************************************************
ok: [localhost] => {
"msg": "before value: [u'listitem_1', u'listitem_2'] after value: [u'listitem_1_changed', u'listitem_2_changed']"
}
TASK [modify the list values by appending to the end with .changed] *******************************************************************************
[vdo023@localhost list_dicts]$ ansible-playbook -i "localhost," ./list_dicts-playbook.yml
PLAY [Test playbook for checking dictionaries] ****************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************************
ok: [localhost]
TASK [Accessing direct dictionary] ****************************************************************************************************************
ok: [localhost] => {
"msg": "hostname is test and ip is 127.0.0.1"
[vdo023@localhost selectattr]$ ansible-playbook -i "localhost," ./selectattr-playbook.yml
PLAY [localhost] **********************************************************************************************************************************
TASK [extract the emails for users without a password] ********************************************************************************************
ok: [localhost]
TASK [debug message] ******************************************************************************************************************************
ok: [localhost] => (item=johnsmith@gmail.com) => {
"changed": false,
[vdo023@localhost jinja2-map]$ ansible-playbook -i "localhost," ./j2-map-playbook.yml
PLAY [localhost] **********************************************************************************************************************************
TASK [establish the first name from the mps dictionary] *******************************************************************************************
ok: [localhost] => {
"msg": [
"Tony",
"Theresa",
"Nigel"