Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/isaudkhan/ansible-install-apache-vagrant

Install Apache on Vagrant VMs using Ansible
https://github.com/isaudkhan/ansible-install-apache-vagrant

ansible apache ubuntu vagrant

Last synced: about 1 month ago
JSON representation

Install Apache on Vagrant VMs using Ansible

Awesome Lists containing this project

README

        

# Ansible Project 1
Install Apache Web Server on two Vagrant VMs using Ansible

### Steps:
1. Setup Ansible Controller Machine
- Create Directory: mkdir ansible-controller
- Initialize Vagrant VM: vagrant init
- Update Vagrant file to set up ansible-controller VM: vi vagrantfile
- Start VM: vagrant up
- SSH VM: vagrant ssh
- Check ansible version: ansible --version

2. Setup SSH on Controller Machine
- Generate ssh keys on ansible-controller: ssh-keygen
- Copy public ssh key to shared folder

``
cp /home/vagrant/.ssh/id_rsa.pub /vagrant
``
- Copy public ssh key to host folder

``
copy id_rsa.pub /ansible-hosts
``

3. Setup Ansible Host Machines
- Create dir: mkdir ansible-hosts
- Initialize Vagrant VMs: vagrant init
- Update Vagrant file to set up two VMs for ansible-hosts
- Start VMs: vagrant up

4. Test SSH connection between Controller and Host Machines

``
ansible -i hosts.vag all -m ping
``

5. Create Hosts and Playbook file on Controller Machine

```
vi hosts.vag
vi ansible-install-apache-vagrant.yml
```
6. Run playbook on ansible-controller
- SSH to ansible-controller machine: vagrant ssh

- Run playbook file ( -l : for specific host )

```
ansible-playbook -i hosts playbook.yml
ansible-playbook -i hosts -l web playbook.yml
```