ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

3 | Ansible Hands-On Demo Project | Step by Step for Beginners

Setting up an Ansible demo project

Writing your first Ansible playbook

Step-by-step guide to configuring remote servers with Ansible

Deploying and managing applications with Ansible

Best practices for Ansible project management

Автор: Automation Step by Step

Загружено: 2023-05-09

Просмотров: 61051

Описание: All Free Tutorials - https://AutomationStepByStep.com/
How to setup Ansible Controller machine
How to setup Ansible Host machines
Making connection between Controller and Hosts
Adding host and playbook file on Controller
Run Playbook to configure Host Machines

We will need Linux machines for this DEMO

You can use any Linux machines or setup using any cloud platforms like AWS
In this Demo I am going to use Vagrant to create Linux Virtual Machines
In any case the process and steps will remain same

Ref:
Create Free Linux on AWS and connect from Windows and Mac OS -    • Create Free Linux on AWS and connect from ...  
Vagrant Beginner Playlist -    • Vagrant Beginner Tutorial  
Vagrant VM Boxes - https://app.vagrantup.com/centos/boxes/7

Part A
Ansible Controller Machine Setup

Step 1 - Install VirtualBox and Vagrant on your local machine.
Step 2 - Open a terminal and navigate to the directory where you want to set up your Ansible project.
Step 3 - Create a new directory for your Ansible controller VM by running the command mkdir ansible-controller
Step 4 - Navigate to the directory and create a new file called Vagrantfile by running the command vagrant init centos/7
Step 5 - Edit the Vagrantfile and add the lines to the end of the file to provision Ansible on the VM

Vagrantfile for creating VM for Ansible Controller

Vagrant.configure("2") do |config|
config.vm.define "ansible-controller" do |controller|
controller.vm.hostname = "controller"
end
config.vm.box = "centos/7"
config.vm.provision "shell", inline: <<-SHELL
sudo yum install epel-release -y
sudo yum install ansible -y
SHELL
end

Step 6 - Save & check its a valid vagrantfile vagrant validate Then run command vagrant up to start the VM
Step 7 - Once the VM is up and running, connect to it using SSH by running the command vagrant ssh
Check ansible is installed - ansible --version
Step 8 - Create a new directory for your Ansible project on the controller VM by running the command mkdir ansible-project
Step 9 - Navigate to the ansible-project directory and create a new file called hosts by running the command touch hosts
Step 10 - Create a new file called playbook.yml. This file will contain the tasks you want to perform on your managed hosts
As of now the hosts and the playbook file are empty
We will now create some host machines that will be controlled by the Ansible controller

Part B
Ansible Host Machines Setup

Step 1 - On terminal navigate to your Ansible Project folder
Step 2 - Create a new directory for your host machines by running the command mkdir host-machines
Step 3 - Navigate to host-machines directory and create a new Vagrantfile by running the command vagrant init centos/7
Step 4 - Edit the Vagrantfile and modify the following lines to set up two Vagrant machines:

Vagrantfile for creating VMs for Ansible Host

Vagrant.configure("2") do |config|
config.vm.box = "centos/7"

config.vm.define "web" do |web|
web.vm.hostname = "web"
web.vm.network "private_network", ip: "192.168.33.10"
end

config.vm.define "db" do |db|
db.vm.hostname = "db"
db.vm.network "private_network", ip: "192.168.33.11"
end
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
config.vm.usable_port_range = (8000..9000)
end

Step 6 - Save & check its a valid vagrantfile vagrant validate Then run command vagrant up to start the VM
Step 7 - Check the status of machines vagrant status
Once the VMs are up, connect to them using SSH vagrant ssh <machine-name> e.g vagrant ssh web
This completes the process of setting up host machines

Part C
Making connection between controller and host machines

Step 1 - Make sure all machines are up and running
Step 2 - Run command ip addr on each machine and check they have IP addresses in the same range (e.g. 192.168.33.x).
Step 3 - On Controller machine run the command ssh-keygen to generate an SSH key pair
Step 4 - Goto ~/.ssh folder and check the public and private keys generated
Step 5 - Copy the public key to the host machines by running the command ssh-copy-id <user>@<host>
For example, to copy the public key to the web machine, run the command ssh-copy-id [email protected]

Can do this manually by copying the contents of the .pub file generated by ssh-keygen and pasting it into the ~/.ssh/authorized_keys file on the host machines

Step 6 - Test the SSH connection by running the ssh command with the IP address of the host machines-
For example: ssh [email protected]
ssh [email protected]


Due to limitation of characters I am adding notes in this PDF file - https://drive.google.com/file/d/1UHOM...

▬▬▬▬▬▬▬

You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can

Never Stop Learning
Raghav Pal


—

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
3 | Ansible Hands-On Demo Project | Step by Step for Beginners

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

4 | From Beginner to Pro: Ansible Playbooks Explained

4 | From Beginner to Pro: Ansible Playbooks Explained

Ansible Full Course | Zero to Hero

Ansible Full Course | Zero to Hero

АСЛАНЯН: Обойдетесь без телефонов. «Новые» российские автомобили. Худшая реклама / МАШИНЫ

АСЛАНЯН: Обойдетесь без телефонов. «Новые» российские автомобили. Худшая реклама / МАШИНЫ

1 | What is Ansible | Getting Started

1 | What is Ansible | Getting Started

Full Ansible Tutorial for Beginners: From Zero to Deploying Your First Playbook

Full Ansible Tutorial for Beginners: From Zero to Deploying Your First Playbook

⚡️ Кремль сорвал попытку ареста Путина || Срочная переброска войск НАТО

⚡️ Кремль сорвал попытку ареста Путина || Срочная переброска войск НАТО

This web UI for Ansible is so damn useful!

This web UI for Ansible is so damn useful!

«Жить надо сегодня». Олег Тиньков и Майкл Калви о взлете нового финтех-стартапа Plata

«Жить надо сегодня». Олег Тиньков и Майкл Калви о взлете нового финтех-стартапа Plata

Максимальное унижение Зеленского

Максимальное унижение Зеленского

you need to learn Ansible RIGHT NOW!! (Linux Automation)

you need to learn Ansible RIGHT NOW!! (Linux Automation)

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]