6 | Ansible Hello World

Описание к видео 6 | Ansible Hello World

Create and run a basic Playbook with Ansible
Install ansible
Create a hello world playbook
Run playbook on local system

Step 1 - Install ansible on your system and check check ansible is installed - ansible --version
Ansible is generally installed on Linux systems
AWS Linux VM -    • Create Free Linux on AWS and connect ...  
Vagrant Linux VM -    • Vagrant Beginner Tutorial  

---------------------------------------
Steps to install Ansible on a Linux VM created with Vagrant

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 2 - Create a new directory mkdir ansible-project
Step 3 - Create a new file called playbook1.yml. This file will contain the tasks you want to perform on your machine
Step 4 - Add the following data in the playbook1.yml file

---
- name: Basic playbook
hosts: localhost
tasks:
- name: Print a message
debug:
msg: "Hello, World!"

Step 5 - Run the playbook ansible-playbook playbook1.yml


Master Ansible basics with step-by-step Hello World playbook
Learn how to create your first Ansible playbook with this Hello World tutorial

▬▬▬▬▬▬▬

Every Like & Subscription gives me great motivation to keep working for you
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
https://AutomationStepByStep.com/

Комментарии

Информация по комментариям в разработке