Ansible tutorial

Sundar blogSundar blog
2 min read

in server Update

in server install ansible,python,git

check ansible version

Create user ansible for all three machines

Edit visudo file in all three machines

Allow root for ansible user

Edit sshd_config file all three machines

password authentication yes

restart sshd all the machines

now change the ansible user in server

now check ssh working

Generate ssh key in server

Copy ssh key from server to node1

Copy ssh key from server to node2

now try to ssh, its not need password

Edit the host file in server

Edit ansible.cfg file

run this command in server

ping all the client

enable silent installation for python

Check client hostnames

View all the nodes list

create a file in all the nodes

Install git for all nodes

verify httpd installed or not

Remove httpd

install docker all nodes

verify docker installed or not

unistall docker

install httpd

start httpd service

Create a user in both nodes

Ansible playbook

Create a playbook

inside content

run playbook

Check playbook work or not

Check tree installed or not

Create a another playbook

run a playbook

Install a package using playbook

tree package

run a playbook

Create a file using ansible playbook

run ansible playbook

Create a directory using playbook

run playbook

delete a directory using playbook

run a playbook

copy a file in hosts

run a playbook

Install a package and start a service

run playbook

Stop a service and uninstall

run a playbook

Install complete webserver

run playbook

0
Subscribe to my newsletter

Read articles from Sundar blog directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sundar blog
Sundar blog