Ansible for beginners -- Complete end-to-end tutorial video with practical solution

  Рет қаралды 7,452

DevOps Mela

DevOps Mela

Күн бұрын

Below is the list of topics covered in the Web-Series:
- Course Introduction 00:00 - 01:08
- Ansible Overview 01:25 - 12:00
- Ansible Inventory 12:05 - 21:30
- Ansible AD-HOC Commands 22:00 - 41:00
- Ansible Playbooks 43:00 - 01:03:00
- Ansible Variables 01:04:00 - 01:10:00
- Ansible Roles 01:10:11 - 01:29:10
- Ansible integration with Azure DevOps 01:30:00 - 01:57:00

Пікірлер: 26
@DevOpsMela
@DevOpsMela Жыл бұрын
## Ansible Installation on Ubuntu:20.04 ## sudo apt update sudo apt install software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible sudo apt install ansible ## Ansible Version ## - ansible --version ## Setting Ansible Inventory ## vi /etc/ansible/hosts ## Test Inventory file ## ansible all -m ping ansible -i hosts all -m ping -u devopsmela -k {-u = become sudo, -k = prompt for pass} ** Escalate permission with -b flag ** ## Running through custom inventory file ## ansible -i hosts all -m ping ## Run without ansible_ssh_pass option in inventory file ansible -i hosts all -m ping -k ## Setup Ansible Variables ## ansible_connection=(ssh/local) ansible_user= ansible_ssh_pass= ansible_port= ansible_host= ## Ansible AD-HOC ## ## Modules: ** shell - ansible localhost -m shell -a 'ls' {-m = module, -a = module args} ** copy - ansible atlanta -m copy -a "src=/etc/hosts dest=/tmp/hosts" ** file - ansible webservers -m file -a "dest=/srv/foo/a.txt mode=600" - ansible webservers -m file -a "dest=/srv/foo/b.txt mode=600 owner=mdehaan group=mdehaan" ## Create directory: - ansible webservers -m file -a "dest=/path/to/c mode=755 owner=mdehaan group=mdehaan state=directory" ## Delete directory: - ansible webservers -m file -a "dest=/path/to/c state=absent" ** apt - ansible webservers -b -m apt -a "name=apache2 state=present" - ansible webservers -m copy -a "src=index.html dest=/var/www/html" ** setup {Gathering facts} - ansible all -m setup ** Disable Host_key_check ** ansible-config init --disabled > ansible.cfg vi /etc/ansible/ansible.cfg host_key_check=False ## Ansible Playbooks ## ** Install Apache and Start services --- - name: Apache Install hosts: all become: true tasks: - name: Update OS command: apt update - name: Apache Latest Version apt: name: apache2 state: present - name: Apache Service Start service: name: apache2 state: started - name: Copy config file copy: src: index.html dest: /var/www/html/index.html ** Adding VARIABLES to the playbook --- - name: Apache Install hosts: all become: true vars: app: apache2 tasks: - name: Update OS command: apt update - name: Apache Latest Version apt: name: "{{ app }}" state: present - name: Apache Service Start service: name: "{{ app }}" state: started - name: Copy config file copy: src: index.html dest: /var/www/html/index.html ## Ansible Roles ## - ansible-galaxy init apache_role ** Add below code in tasks/main.yml - name: Update OS command: apt update - name: Apache Latest Version apt: name: "{{ app }}" state: present - name: Apache Service Start service: name: "{{ app }}" state: started - name: Copy config file copy: src: index.html dest: /var/www/html/index.html ** Add below code in vars/main.yml app: apache2 ** Create playbook to use ansible roles - hosts: all become: true roles: - apache_role ## Ansible Integration with Azure DevOps ## - Launch Ubuntu VM on Azure Cloud - Setup Azure CLI {curl -sL aka.ms/InstallAzureCLIDeb | sudo bash} - Run az login command - Run az account show (copy subscription Id) ** Create service principal ** az ad sp create-for-rbac --name ansible-sp-dev --role Contributor --scopes /subscriptions/ - Create mkdir ~/.azure - Edit file ~/.azure/credentials and add below blocks [default] subscription_id=? client_id=? secret=? tenant=? ** Generate private and public keys ** - ssh-keygen -m PEM -t rsa -b 2048 - chmod 755 ~/.ssh - touch ~/.ssh/authorized_keys - chmod 644 ~/.ssh/authorized_keys - ssh-copy-id devopsmela@127.0.0.1 - ssh devopsmela@127.0.0.1 {Verify key login} - cat ~/.ssh/id_rsa {Copy the private key} ** Create SSH Service Connection in Azure DevOps - paste the private key copied ** Create release pipeline - Ansible location --> Remote Machine - Playbook --> Source --> Agent Machine {If playbook and others are part of repositories} - Inventory Location --> Use default inventory file
@shakthidharga9967
@shakthidharga9967 Жыл бұрын
You're doing a quality video's. It's really helping me in my interview preparation and learning tools
@DevOpsMela
@DevOpsMela Жыл бұрын
Thanks! For the valuable feedback…
@venkatavamsi6930
@venkatavamsi6930 10 ай бұрын
You desever a million views bro.. Thank you so much
@DevOpsMela
@DevOpsMela 10 ай бұрын
Thanks! Bro
@amadoudiop6634
@amadoudiop6634 5 ай бұрын
Thank you very for this awesome tutorial
@DevOpsMela
@DevOpsMela 5 ай бұрын
Welcome 🙌
@seemasingh4619
@seemasingh4619 Жыл бұрын
Perfect... Thanks!!
@DevOpsMela
@DevOpsMela Жыл бұрын
Welcome!
@danielventurini7273
@danielventurini7273 10 ай бұрын
I ran over two other videos on KZfaq, but your one is the best I found today. Keep going, bro +1 sub
@DevOpsMela
@DevOpsMela 10 ай бұрын
Thanks! for the valuable feedback
@Raviteja6031
@Raviteja6031 Жыл бұрын
Nice video... please make a video on Ansible-vault
@DevOpsMela
@DevOpsMela Жыл бұрын
Sure! Thanks for suggestion
@WorldofGowtham
@WorldofGowtham Жыл бұрын
Great work. it is really helpful...The way you teach is very clear and understandable...Now, i got some knowledge on Ansible. Thank you very much for the video. one question: using Ansible, can we configure windows also or it is useful to configure Linux only?
@DevOpsMela
@DevOpsMela Жыл бұрын
Thanks! for the valuable feedback Yes! You can configure windows too
@nagulmeerashaik5336
@nagulmeerashaik5336 Жыл бұрын
Thanks bro😊🎉
@DevOpsMela
@DevOpsMela Жыл бұрын
Welcome!!
@Letmework247
@Letmework247 6 ай бұрын
Nice job
@DevOpsMela
@DevOpsMela 6 ай бұрын
Thanks!
@Arun_7793
@Arun_7793 4 ай бұрын
how kubernetes and secrets manager or vaults are integrated?
@DevOpsMela
@DevOpsMela 4 ай бұрын
Will get the topic covered in the next upcoming video’s
@Arun_7793
@Arun_7793 4 ай бұрын
please explain how the vault is integrated
@DevOpsMela
@DevOpsMela 4 ай бұрын
👍🏻 will get it covered
@Arun_7793
@Arun_7793 4 ай бұрын
@@DevOpsMela thank you for responding
@harishchary3404
@harishchary3404 Жыл бұрын
Bro I want follow your LinkedIn
@DevOpsMela
@DevOpsMela Жыл бұрын
Check my website devopsmela.in I got my Linkedln link mentioned…
DevOps - Ansible (Part -1) in Tamil | Greens Technologys
1:38:57
Greens Technologys
Рет қаралды 19 М.
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 49 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 6 МЛН
3 | Ansible Hands-On Demo Project | Step by Step for Beginners
55:52
Automation Step by Step
Рет қаралды 39 М.
Why You NEED To Learn Terraform | Practical Tutorial
27:33
Travis Media
Рет қаралды 105 М.
JENKINS END TO END CICD Implementation with Detailed Notes | BEST CICD PROJECT
1:27:11
Ansible Tutorial, Ansible Crash Course, Learn Ansible
2:33:37
Vikas Jha
Рет қаралды 10 М.
Simple automation for all your Linux servers with Ansible
26:00
Christian Lempa
Рет қаралды 68 М.
Day 26: Continous Deployment & Delivery Concepts | Demo
58:50
Kubernetes Crash Course for Absolute Beginners [NEW]
1:12:04
TechWorld with Nana
Рет қаралды 2,6 МЛН
Ansible Tips and Tricks
49:32
Red Hat Ansible Automation
Рет қаралды 9 М.
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 11 МЛН
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 6 МЛН
Как бесплатно замутить игровой ноутбук
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 183 М.