Most useful git commands

Most useful git commands are git init, git add ., git commit, git push, git pull, git feth

1. git init// to start local repo

2. git add .//to add local changesto staging area

3. git commit -m “change1″// to collect stagedchanges

4. git push// to push localcommittedchanges toremote branch

5. git fetch// will fetchremote branchchanges to yourlocal repo (notto workspcae)

6. git pull// it is git fetch + mergeto your workspace

7. git remote show origin// to find remote git url

8. git checkout baranch// checkout to local branchall commits will be recorded

9. git checkout -b branch// create new local branchand check out

What is Blue/Green Deployment and its Pros/Cons

What is Blue/Green Deployment and its Pros/Cons

t’s an Advanced
Deployment process
with following steps

1. While Blue environment
is active and supporting
production users,
Green environment
will be upgraded,
then smoke tested

2. After successful
smoke test, Load balancer
will direct user traffic
to Green environment

3. Now Blue
environment
will be upgraded

Pros:
Uninterrupted
availability of services
during deployment

Cons:
Expensive to maintain
duplicate
production environment

What is Rolling Updates – Advanced deployment strategy

DevOps #2 What is Rolling Updates or Deployment | Incremental node updates on multi node environment

Rolling updates are
done for Multi node
environment. Here
each node will
be taken out, upgraded,
smoke tested and
then redeployed.
Process repeated until
all nodes are upgraded
individually

Pros:                
Incremental,
zero downtime
incremental
deployement

Cons:               
unpredictable
behavior
may be noticed
due to each node
level updates

How to create Molecule and test Ansible tasks

For Ansible Molecule setup the following commands needs to be executed:
1.pip install
2.virtualenv ansible(will create virtual env
for python with ansible name)

  1. cd ansible (to go to ansible folder)
  2. source bin/activate (to activate python env)
  1. pip install molecule anisble molecule[docker] docker Now, verify ansible and molecule version
  2. ansible –version
  3. molecule –version

run command :

  1. molecule init role
    -r my-ansible-molecule-role
  2. cd my-ansible-molecule-role

folder “my-ansible-molecule-role”
will have following folders
1.defaults
2.handlers
3.meta
4.molecule
5.tasks
6.vars
except molecule, all folders have main. yml

molecule folder has
1.default > task folder
2.molecule.yml
3.playbook. yml
4.Dockerfile

now, run command

  1. cd..(to go to parent folder)
    store yml files in tasks folder thatto be tested and linted by molecule

now just run command

  1. molecule test
  2. molecule destroy
  3. molecule converge

How to create Ansible roles

Ansible Role is set of directory structures and yml files

Roles help to organize set of tasks and group it

command (to create role):

Ansible-galaxy init /etc/ansible/roles/project1 –offline

now, project1 directory has 8 directories:
1.defaults
2.files
3.handlers
4.meta
5.tasks
6.templates
7.tests
8.vars

except files and templates, all other directories have main.yml file

defaults and vars carry variables. priority goes
to vars

task stores all playbook tasks grouped and maintained