This is demo/test project based on Vagrant and Ansible tools. You will be able to setup:
!!! Do NOT use this example project in Production ENV. as it has not been tested properly and has no firewall setting, except SELinux enalbled !!!
All above mentioned will use Centos 7 minimal "centos/7 CentOS Linux 7 x86_64 Vagrant Box" from [ Vagrant boxes Atlas ] (https://atlas.hashicorp.com/boxes/search)
[ Centos 7 minimal ] (https://www.centos.org/)
[ VirtualBox by Oracle ] (https://www.virtualbox.org/)
[ Vagrant ] (https://www.vagrantup.com/)
[ Ansible ] (https://www.centos.org/)
- I assume you have already installed Required OS and Software then skip to step 2. if not then install Cenots 7 minimal and start with step 1.
1. Project setup process:
1.1. When installing centos 7 create user vagrant with administrator privileges.
1.2. After copy GitHub project to your server and put it in your working directory, for exmaple "myproject"
1.3. Then set chmod to bash script "server_setup.sh" and run the script:
chmod 0700 server_setup.sh
./server_setup.sh
- This script will install all nessasary software to run the Vagrant & Ansible project
2. Running the project:
2.1. Before you start project please edit:
2.1.1. IP used in this project:
Loadbalancer server Public network IP`s: 10.10.20.111
Loadbalancer server Private network IP`s: 192.168.56.11
WEB servers Public network IP`s: 10.10.20.121 - 122
WEB servers Private network IP`s: 192.168.56.21 - 22
Database servers Public network IP`s: 10.10.20.131 - 122
Database servers Private network IP`s: 192.168.56.31 - 32
2.1.2. hosts file in direcotry "provisioning/src/hosts" and edit IP`s you will use in you project. Edit only first part of IP, example "10.10.20.111" -> "10.20.30.111"
2.1.3. Copy edited content to you local hosts file /etc/hosts
2.2. Vagrantfile file in main project direcotry change IP`s according to hosts file.
2.3. Run command:
vagrant up
and you will setup all server automaticly.
2.5. Access machines by domain name:
HAProxy: node.bz/stats
Web page: node.bz | This domain will be redirected to secure SSL connection -> https://node.bz
2.6. Access machines using via SSH:
If you are not in your project working directory, please, go to it, and see first machines you have setup and make shure they are running before try to acccess them:
vagrant status
To access any of VM machines, type following command, for example machine "loadbalancer":
vagrant ssh loadbalancer
Default username for all VM machines is vagrant and password also is vagrant
2.7. Stop all VM machines:
vagrant halt
2.8. Stop one or several VM machines:
vagrant halt web1
2.8. Destory one or several VM machines:
vagrant destroy web1
vagrant destroy web1 web2 db1 db2