Skip to content

Commit 0f087ee

Browse files
Update Ansible_Commands_StepByStep
1 parent af95fe9 commit 0f087ee

File tree

1 file changed

+50
-26
lines changed

1 file changed

+50
-26
lines changed

Ansible/Ansible_Commands_StepByStep

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,60 @@
1-
2-
Configuration Management Tool
3-
IaaCode
41

5-
Inventory:-List of hosts
6-
Frank--->100 Machine
7-
Each every machine and installing Jdk 8
8-
Ansible-->Angentless
2+
----------------------------Installation of Ansible---------------------------
3+
--BELOW STEPS ARE TO INSTALL ANSIBLE ON UBUNTU
94

10-
Simple, agentless IT automation
11-
that anyone can use
5+
RUN BELOW COMMANDS ON MASTER ( LOGIN WITH ROOT USER)
126

13-
----------------------------Installation of Ansible---------------------------
14-
--Commands to install Ansible on Master node
7+
1. ssh-keygen
8+
2. cat /root/.ssh/id_rsa.pub
9+
copy the content of this file
10+
11+
GOTO AGENT MACHINE
12+
13+
1. open /root/.ssh/authorized_keys file and copy master ssh key at the end of this file
14+
15+
RUN BELOW COMMANDS ON MASTER
16+
17+
1. ssh <<agent Ip>>
18+
2. Before installing ansible package add ansible repository to your system
19+
sudo apt-add-repository ppa:ansible/ansible
20+
3. Run the update command before installing to update existing packages
21+
sudo apt-get update
22+
4. Now install the ansible package
23+
sudo apt-get install ansible
24+
5. You can check if you’re on the latest version of ansible by running the version command
25+
sudo ansible --version
26+
27+
SETUP HOST MACHINE ON MASTER
28+
29+
1. To set up hosts you need to edit the hosts file in the ansible directory
30+
cd /etc/ansible
31+
vi hosts
32+
33+
---BELOW STEPS ARE TO INSTALL ANSIBLE ON CENTOS SYSTEM
1534

35+
RUN BELOW COMMANDS ON MASTER ( LOGIN WITH ROOT USER)
36+
37+
1. ssh-keygen
38+
2. cat /root/.ssh/id_rsa.pub
39+
copy the content of this file
40+
GOTO AGENT MACHINE
41+
42+
1. open /root/.ssh/authorized_keys file and copy master ssh key at the end of this file
43+
44+
--BELOW STEPS ARE TO INSTALL ANSIBLE
1645
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
1746
yum install ansible
47+
ansible --version
48+
49+
50+
51+
SETUP HOST MACHINE ON MASTER
52+
53+
1. To set up hosts you need to edit the hosts file in the ansible directory
54+
cd /etc/ansible
55+
vi hosts
56+
1857

19-
--Configuration to setup SSH on Client and Master Machine
20-
--Remove the comments from the ssh/sshd_config file which is to be overwritten
21-
vi etc/ssh/sshd_config
22-
-- After making the changes restart the sshd
23-
systemctl restart sshd
24-
--Generate the public key on Master machine which is to shared with clients
25-
ssh-keygen
26-
--following file will be created at id_rsa.pub which contains the value of public key
27-
cd /root/.ssh
28-
cat id_rsa.pub
29-
--Copy the content of id_rsa.pub file
30-
--Goto Client Machine and got to /root/.ssh folder and append the master's public key to authorized_keys files
31-
32-
--Add the hosts(IP addresses or in hosts file on the master machine under /etc/ansible folder
33-
add client hosts
3458

3559

3660
--------------------Ansible Adhoc Commands---------------------------------

0 commit comments

Comments
 (0)