Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
SDLC
===========================================================
PLAN -> CODE -> ANA -> Build -> UT -> Pack -> Archive -> Dep2QA
---------------------------------------------------------------
GIT SONAR Maven ---- ------- Artifactory --> Ansible
==========================================================================
What is Ansible?
------------------------------
Config mgmt tool
deployment tool
From REDHAT
Writtin in Python
Release
cli - free n os == ansible
gui - paid == ansible tower
What is Config mgmt
---------------------------
Server(S) config
What is there in Server?
---------------------------------
file
dir
user
apt
yum
group
DevOps.war ---> 10 Server
----------------------------
1. install java === apt
2. install tomcat === wget - tar
3. install mysql == apt
4. install app DevOps.war === curl from Artifactory
5. Config app to connect to DB === file modification
Why ANSIBLE
==============================
How to install ansible?
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible
Others tool
-----------------------
Ansible Arch
------------------------------------------------
HUMAN --> ACS ----> ARS
----------------------------------
LINUX ANY
PYTHON LINuX - python
windows - DOTNET & PS3.0
-----------COMMUNCATION----------->
SSH ----- LINUX
WINRM(HTTP) ----> WIndows
Ansible NA -- Agent Less
ACS
=============================
Ansible
- Executables =
- Modules ==== A py code which would be run ARS
https://docs.ansible.com/ansible/2.9/modules/modules_by_category.html
- Plugins ==== A py code which add func of Ansible
- Configfile = /etc/ansible/ansible.cfg
Human
- playbook
- inventory
- role
=============================================
Project - setup a web servers
Psucode
---------------------------
S1 - install apache ansible.builtin.apt | state
S2 - Copy index.html to /var/www/html ansible.builtin.copy module
S3 - Start a apache svc ansible.builtin.service module
==========================================================
IF u want to copy 1 file 1 machine
----------------------------------
cmd = ansible Adhoc == ansible
script == playbook == ansible-playbook
Ansible Adhoc Command
-------------------------------
ansible localhost -m apt -a"state=present name=apache2" -b
ansible localhost -m copy -a"dest=/var/www/html src=index.html" -b
ansible localhost -m service -a"name=apache2 state=started" -b
===================================================================
inventory
------------------------------------
LIST of IP Address Of ARS
CMD
file
script
ansible all -i inventory -m apt -a"state=present name=apache2" -u ubuntu -k -b
ansible all -i inventory -m copy -a"dest=/var/www/html src=index.html" -u ubuntu -k -b
ansible all -i inventory -m service -a"name=apache2 state=restarted" -u ubuntu -k -b
54.197.84.39
35.175.142.240
----------------------
How to enable and set a password in Ec2 instance?
$ sudo -s
$ vi /etc/ssh/sshd_config
$ Locate "PasswordAuthentication" and uncomment and make it yes. ie. PasswordAuthentication yes
$ systemctl restart sshd
$ passwd ubuntu
pass
re-pass
==========================================================
PLAYBOOK
---------------------------
yaml file
contians play
play
-----------------
hosts: groupname from the inventory
tasks: List of module
---
- name: Update web servers
hosts: all
tasks:
- name: Install Apache in ubuntu
ansible.builtin.apt:
name: "apache2"
state: latest
- name: Copy index.html
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Starting a Apache Server
ansible.builtin.service:
name: "apache2"
state: started
ansible-playbook -i inventory web.yaml -u ubuntu -k -b