Skip to content

Commit 06a9633

Browse files
authored
Ansible installation file initial commit
1 parent 4af4e57 commit 06a9633

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Ansible/Ansible_installation.MD

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Ansible Installation
2+
3+
Ansible is an open source automation platform. It is very, very simple to setup and yet powerful. Ansible can help you with configuration management, application deployment, task automation.
4+
5+
### Follow this in **[YouTube](https://www.youtube.com/watch?v=79xFyOc_eEY)
6+
7+
### Prerequisites
8+
9+
1. An AWS EC2 instance
10+
11+
### Installation steps:
12+
13+
Add a EPEL (Extra Packages for Enterprise Linux)third party repository to get packages for Ansible
14+
```sh
15+
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
16+
```
17+
18+
Install Ansible
19+
```sh
20+
yum install ansible -y
21+
```
22+
23+
Check Ansible version
24+
25+
```sh
26+
ansible --version
27+
```
28+
29+
Create a new user for ansible administration & grant admin access to user (Master and Slave)
30+
```sh
31+
useradd ansadmin
32+
passwd ansadmin
33+
# below command addes ansadmin to sudoers file. But strongly recommended to use "visudo" command if you are aware vi or nano editor.
34+
echo "ansadmin ALL=(ALL) ALL" >> /etc/sudoers
35+
```
36+
37+
Using keybased authentication is advised. If you are still at learning stage use password based authentication (Master & Slave)
38+
```sh
39+
# sed command replaces "PasswordAuthentication no to yes" without editing file
40+
sed -ie 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
41+
```
42+
Login as a ansadmin user on master and generate ssh key (Master)
43+
```sh
44+
ssh-keygen
45+
```
46+
Copy keys onto all ansible client nodes (Master)
47+
```sh
48+
ssh-copy-id <target-server>
49+
```
50+
51+
Update target servers information on /etc/ansible/hosts file (Master)
52+
```sh
53+
echo "<target server IP>" > /etc/ansible/hosts
54+
```
55+
Run ansible command as ansadmin user it should be successful (Master)
56+
```sh
57+
ansible all -m ping
58+
```

0 commit comments

Comments
 (0)