This file discribe all the steps in order to setup a Vagrant box (using the Ansible Ubuntu simple Symfony App config - please refer to this repository for more info).
$ cd ~/vagrant/vm1
$ vagrant box add {title} {url}
$ vagrant init {title}
For example:
$ cd ~/vagrant/vm1
$ vagrant box add ubuntu_14_04_basebox https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box
$ vagrant init ubuntu_14_04_basebox
Add the following lines in your VagrantFile
config.vm.network "forwarded_port", guest: 20, host: 20020
config.vm.network "forwarded_port", guest: 21, host: 20021
config.vm.network "forwarded_port", guest: 22, host: 20022
config.vm.network "forwarded_port", guest: 80, host: 20080
for i in 1024..1048
config.vm.network :forwarded_port, guest: i, host: i
end
config.vm.network "forwarded_port", guest: 3306, host: 23306
$ vagrant up
Clone the Ansible Ubuntu simple Symfony App.
$ cd ~/git
$ git clone https://github.com/Remiii/remiii-ansible-ubuntu-app-simple-symfony.git
$ cd remiii-ansible-ubuntu-app-simple-symfony
*** WARNING: is just a sample, please ie. remiii-ansible-ubuntu-app-simple-symfony ***
Setup the vars in vars/myConfig.yml
and add ansible_inventory_machinename
file: More info here.
# ansible_inventory_machinename
machine ansible_ssh_host='127.0.0.1' ansible_ssh_port=20022
Copy the config dist file vars/myConfig.yml.dist
$ cp vars/myConfig.yml.dist vars/myConfig.yml
# pathToTheProject/vars/myConfig.yml
...
rootPath: '~/git/remiii-ansible-ubuntu-app-simple-symfony'
hostname: 'vm1.local'
publicIpAddress: '127.0.0.1'
...
Add some files in the vars
directory: More info here.
- myGitUserMachineUserKey
- myGitUserMachineUserKey.pub
- mySSHPublicKey.pub
- ...
Exec the config:
$ ansible-playbook -i ansible_inventory_machinename --private-key=pathToYourVagrantPrivateKey -u vagrant ./myConfig.yml
$ sudo vi /etc/hosts
Add the following lines in your hosts /etc/hosts
file:
###
# VM1
###
127.0.0.1 vm1.local sql.vm1.local apc.vm1.local website-sample.vm1.local website-sample1.vm1.local website-sample2.vm1.local foo.vm1.local
$ cd ~/vagrant/vm1
$ vagrant reload
$ vargant ssh
MIT
- Rémi Barbe (aka Remiii)