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?
Thanks good video, but if you want to be great video , 😊you would show how to use in production, ie dont disable host key check. Setup vault all from beginning, just some advice. So many videos show the "lazy" way. Standout by going extra mile
## 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
You're doing a quality video's. It's really helping me in my interview preparation and learning tools
Thanks! For the valuable feedback…
You desever a million views bro.. Thank you so much
Thanks! Bro
Thank you very for this awesome tutorial
Welcome 🙌
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?
Thanks! for the valuable feedback
Yes! You can configure windows too
I ran over two other videos on TH-cam, but your one is the best I found today.
Keep going, bro
+1 sub
Thanks! for the valuable feedback
how kubernetes and secrets manager or vaults are integrated?
Will get the topic covered in the next upcoming video’s
Thanks good video, but if you want to be great video , 😊you would show how to use in production, ie dont disable host key check. Setup vault all from beginning, just some advice. So many videos show the "lazy" way. Standout by going extra mile
Thanks! Kelly for the suggestion
Definitely will covers those in my advance topics
Nice video...
please make a video on Ansible-vault
Sure! Thanks for suggestion
Nice job
Thanks!
Perfect... Thanks!!
Welcome!
Thanks bro😊🎉
Welcome!!
please explain
how the vault is integrated
👍🏻 will get it covered
@@DevOpsMela thank you for responding
Bro I want follow your LinkedIn
Check my website devopsmela.in I got my Linkedln link mentioned…