Installing Apache in Remote hosts Using Ansible Playbook.
- Category : Linux Helpline (Easy Guide)
- Posted on : Jan 02, 2019
- Views : 2,392
- By : Marcus J.
Ansible is an open source automation tool. Which is very simple to setup and yet powerful.It can help you with task automation,configuration management,application deployment.
Ansible is available for free and runs on Linux, Mac or BSD. Aside from the free offering, Ansible also has an enterprise product called Ansible Tower.
First testing.
After installing ansible and added few hosts to the inventory file, normally /etc/ansible/hosts you can check connection between them using ping.A connection will be made with ssh keys and you can also specify a username and password.
[root@ansible playbooks]# ansible all -m ping
10.0.0.209 | SUCCESS => {
"changed": false,
"ping": "pong"
}
10.0.0.206 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@ansible playbooks]#
Here “all” keyword is for all of the hosts in your inventory.
Playbook.
The real strength of Ansible lies in its playbooks. Playbooks are written in YAML
ansible-playbook [options] playbook.yml [playbook2 ...]
1.Creating playbook for installing httpd.
# cat httpd..
---
- hosts: apache
tasks:
name: install httpd*
yum: name=httpd state=latest
2. Run the newly created playbook.
#ansible-playbook httpd.yaml
Which shows,
PLAY [apache] ****************************************************************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************************************************************
ok: [10.0.0.206]
ok: [10.0.0.209]
TASK [install httpd*] ********************************************************************************************************************************************************************************
changed: [10.0.0.206]
changed: [10.0.0.209]
PLAY RECAP *******************************************************************************************************************************************************************************************
10.0.0.206 : ok=2 changed=1 unreachable=0 failed=0
10.0.0.209 : ok=2 changed=1 unreachable=0 failed=0
If you visit your secondary server’s hostname or IP address in your browser, you should now get apache default page
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu