Тёмный

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

DevOps Mela
Подписаться 17 тыс.
Просмотров 8 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 28   
@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
@Kelly-wy2uf
@Kelly-wy2uf 2 месяца назад
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
@DevOpsMela
@DevOpsMela 2 месяца назад
Thanks! Kelly for the suggestion Definitely will covers those in my advance topics
@Arun_7793
@Arun_7793 6 месяцев назад
how kubernetes and secrets manager or vaults are integrated?
@DevOpsMela
@DevOpsMela 6 месяцев назад
Will get the topic covered in the next upcoming video’s
@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 Год назад
You desever a million views bro.. Thank you so much
@DevOpsMela
@DevOpsMela Год назад
Thanks! Bro
@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
@Raviteja6031
@Raviteja6031 Год назад
Nice video... please make a video on Ansible-vault
@DevOpsMela
@DevOpsMela Год назад
Sure! Thanks for suggestion
@amadoudiop6634
@amadoudiop6634 7 месяцев назад
Thank you very for this awesome tutorial
@DevOpsMela
@DevOpsMela 7 месяцев назад
Welcome 🙌
@seemasingh4619
@seemasingh4619 Год назад
Perfect... Thanks!!
@DevOpsMela
@DevOpsMela Год назад
Welcome!
@Letmework247
@Letmework247 9 месяцев назад
Nice job
@DevOpsMela
@DevOpsMela 9 месяцев назад
Thanks!
@nagulmeerashaik5336
@nagulmeerashaik5336 Год назад
Thanks bro😊🎉
@DevOpsMela
@DevOpsMela Год назад
Welcome!!
@Arun_7793
@Arun_7793 6 месяцев назад
please explain how the vault is integrated
@DevOpsMela
@DevOpsMela 6 месяцев назад
👍🏻 will get it covered
@Arun_7793
@Arun_7793 6 месяцев назад
@@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…
@danielventurini7273
@danielventurini7273 Год назад
I ran over two other videos on RU-vid, but your one is the best I found today. Keep going, bro +1 sub
@DevOpsMela
@DevOpsMela Год назад
Thanks! for the valuable feedback
Далее
Why You NEED To Learn Terraform | Practical Tutorial
27:33
БЕЛКА ЗВОНИТ ДРУГУ#cat
00:20
Просмотров 870 тыс.
This web UI for Ansible is so damn useful!
20:07
Просмотров 483 тыс.
Ansible in 100 Seconds
2:34
Просмотров 598 тыс.