Skip to content

Commit

Permalink
Improved Vagrantfile and added ansible provision
Browse files Browse the repository at this point in the history
This commit adds Vagrantfile and ansible to add provision to Vagrant image

Signed-off-by: Farhaan Bukhsh(fhackdroid) <[email protected]>
  • Loading branch information
farhaanbukhsh committed Mar 3, 2017
1 parent 409664b commit 315abee
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Vagrant.configure("2") do |config|
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 9000, host: 9000

# Create a private network, which allows host-only access to the machine
# using a specific IP.
Expand All @@ -47,13 +48,15 @@ Vagrant.configure("2") do |config|
# the above mentioned line
# config.vm.synced_folder ".", "/home/vagrant/devel", type: "sshfs", sshfs_opts_append: "-o nonempty", reverse: true
#
# This config installs various system dependency for irc as required to run
# it
config.vm.provision "shell", inline: "sudo dnf -y install python3 python3-devel openssl openssl-devel redis"
config.vm.provision "shell", inline: "sudo pip3 install -r devel/requirements.txt"
config.vm.provision "shell", inline: "python3 setup.py develop"
# Comment this line if you would like to disable the automatic update during provisioning
config.vm.provision "shell", inline: "sudo dnf upgrade -y"
# bootstrap and run with ansible
config.vm.provision "shell", inline: "sudo dnf -y install python2-dnf libselinux-python"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/vagrant-playbook.yml"
end
config.vm.provision "shell", inline: "cd /home/vagrant/devel && sudo python3 setup.py develop"
config.vm.provision "shell", inline: "sudo systemctl start redis.service"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/ircb-dev/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: restart redis
service: name=redis state=restarted
35 changes: 35 additions & 0 deletions ansible/roles/ircb-dev/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
- name: Install helpfull packages
dnf: name={{ item }} state=present
with_items:
- git
- python-rpdb
- tmux
- tree
- vim-enhanced

- name: Install ircb development packages
dnf: name={{ item }} state=present
with_items:
- gcc
- libffi-devel
- python-alembic
- redis
- python3-devel
- openssl-devel
- python-pip
- python-virtualenvwrapper
- python-devel
- libffi
- python
- zeromq
- zeromq-devel
- redhat-rpm-config

- name: Install python packages for ircb
pip: requirements=/home/vagrant/devel/requirements.txt executable=pip3.5

- name: Run python3 setup
shell: python3 setup.py develop
args:
chdir: /home/vagrant/devel
7 changes: 7 additions & 0 deletions ansible/vagrant-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: all
become: true
become_method: sudo
vars:
roles:
- ircb-dev
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ aiohttp-session[secure]==0.5.0
aiozmq==0.7.1
msgpack-python==0.4.7
PyYAML==3.11
redis

0 comments on commit 315abee

Please sign in to comment.