Skip to content

Commit

Permalink
rework
Browse files Browse the repository at this point in the history
- get rid of shell provisioner
 - no python symlinking
- split up ansible playbook into tasks
- improve network and pf setup
  • Loading branch information
lenada committed Jan 17, 2015
1 parent adf8e66 commit 5839bf8
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 53 deletions.
9 changes: 3 additions & 6 deletions Vagrantfile
Expand Up @@ -3,13 +3,13 @@ Vagrant.configure("2") do |config|
config.vm.guest = :freebsd
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_freebsd-10.1_chef-provisionerless.box"
config.vm.box = "opscode_freebsd-10.1_chef-provisionerless.box"
# private network em1 for nfs mount
config.vm.network "private_network", ip: "10.0.1.10"
config.ssh.shell = "/bin/sh"
# Use NFS as a shared folder
config.vm.synced_folder ".", "/vagrant", :nfs => true, id: "vagrant-root"

config.vm.provider :virtualbox do |vb|
# vb.customize ["startvm", :id, "--type", "gui"]
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
Expand All @@ -18,14 +18,11 @@ Vagrant.configure("2") do |config|
vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
#vb.gui = true
end

config.vm.provision "shell" do |s|
s.path = "provision/bootstrap_freebsd.sh"
end

config.vm.provision "ansible" do |ansible|
ansible.playbook = "provision/ansible.yml"
ansible.playbook = "contrib/ansible/vagrant-playbook.yml"
ansible.sudo = true
ansible.verbose = 'v'
end


Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions contrib/ansible/group_vars/all.yml
@@ -0,0 +1,4 @@
---
# Variables listed here are applicable to all host groups.

ansible_python_interpreter: /usr/local/bin/python2
14 changes: 14 additions & 0 deletions contrib/ansible/tasks/dependencies.yml
@@ -0,0 +1,14 @@
---
- name: update packages
command: "pkg update"

- name: upgrade pkg
command: "pkg install -f -y pkg"

- name: ensure dependencies are installed.
pkgng: name={{item}} state=present cached=no
with_items:
- git
- lang/go


11 changes: 11 additions & 0 deletions contrib/ansible/tasks/networking.yml
@@ -0,0 +1,11 @@
---
- name: cloned interface lo1
action: command sysrc cloned_interfaces=lo1

- name: ipv4 addresses for lo1
action: command sysrc ipv4_addrs_lo1=172.23.0.1/16

- name: start lo1
action: command service netif start lo1
register: command_result
failed_when: "'172.23.0.1' not in command_result.stdout"
8 changes: 8 additions & 0 deletions contrib/ansible/tasks/pf.yml
@@ -0,0 +1,8 @@
---
- name: enable pf
action: command sysrc pf_enable=YES

- name: copy pf.conf
copy: src=etc/pf.conf dest="/etc/pf.conf"
notify:
- restart pf
22 changes: 22 additions & 0 deletions contrib/ansible/vagrant-playbook.yml
@@ -0,0 +1,22 @@
---
- hosts: default
tasks:
- include: tasks/dependencies.yml # install git & go
- include: tasks/networking.yml # setup and start lo1
- include: tasks/pf.yml # configure and start firewall

- name: build & install Jetpack
command: "{{ item }} PREFIX=/usr/local"
args:
chdir: "/vagrant"
with_items:
- "make"
- "make install"

- name: init Jetpack
command: "jetpack init"
ignore_errors: yes

handlers:
- name: restart pf
service: name=pf state=restarted
38 changes: 0 additions & 38 deletions provision/ansible.yml

This file was deleted.

9 changes: 0 additions & 9 deletions provision/bootstrap_freebsd.sh

This file was deleted.

0 comments on commit 5839bf8

Please sign in to comment.