Skip to content

Commit ac382cd

Browse files
committed
Inital commit.
0 parents  commit ac382cd

File tree

17 files changed

+165
-0
lines changed

17 files changed

+165
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Emacs backup files...
2+
*~
3+
.\#*

Vagrantfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2") do |config|
5+
config.vm.box = "trusty64-current"
6+
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
7+
config.vm.synced_folder ".", "/vagrant", nfs: true
8+
config.ssh.forward_agent = true
9+
config.vm.provider :virtualbox do |vb|
10+
vb.customize ["modifyvm", :id, "--memory", "2048"]
11+
end
12+
config.vm.define "dev", primary: true do |dev|
13+
config.vm.network "private_network", ip: "10.10.10.10"
14+
config.vm.network :forwarded_port, guest: 4000, host: 4000
15+
config.vm.provision "ansible" do |ansible|
16+
ansible.host_key_checking = false
17+
ansible.playbook = "provisioning/playbook.yml"
18+
ansible.inventory_path = "provisioning/development"
19+
ansible.limit = "all"
20+
end
21+
end
22+
end

provisioning/development

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[development]
2+
10.10.10.10

provisioning/playbook.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- hosts: development
3+
gather_facts: no
4+
sudo: yes
5+
roles:
6+
- role: ntp
7+
tags: ntp
8+
- role: erlang
9+
tags: erlang
10+
- role: elixir
11+
tags: elixir
12+
- role: phoenix
13+
tags: phoenix
14+
- role: postgresql
15+
tags: postgresql
16+
- role: vagrant
17+
tags: vagrant
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: install packages
3+
apt: pkg={{ item }} state=latest update_cache=yes
4+
with_items:
5+
- elixir
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: add erlang repo
3+
apt_repository: repo='deb http://packages.erlang-solutions.com/ubuntu trusty contrib'
4+
5+
- name: add erlang repo key
6+
apt_key: url=https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
7+
8+
- name: install packages
9+
apt: pkg={{ item }} state=latest update_cache=yes
10+
with_items:
11+
- erlang

provisioning/roles/ntp/files/timezone

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Europe/Oslo
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: update timezone
3+
command: dpkg-reconfigure --frontend=noninteractive tzdata

provisioning/roles/ntp/tasks/main.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
- name: set timezone
3+
copy: src=timezone
4+
dest=/etc/timezone
5+
owner=root
6+
group=root
7+
mode=0644
8+
notify:
9+
- update timezone
10+
11+
- name: install ntp
12+
apt: pkg=ntp state=latest
13+
14+
- name: make sure ntp is running
15+
service: name=ntp state=running enabled=yes
16+
17+
# Flush handlers so that we can be sure the system uses the timezone from
18+
# /etc/timezone (even if laters tasks fail)
19+
- meta: flush_handlers
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
- name: install nodejs and npm packages (yes, really)
3+
apt: pkg={{ item }} state=latest update_cache=yes
4+
with_items:
5+
- nodejs
6+
- npm
7+
8+
- name: symlink nodejs to node
9+
file: src=/usr/bin/nodejs dest=/usr/bin/node state=link
10+
11+
- name: install local.hex package manager
12+
sudo_user: vagrant
13+
sudo: yes
14+
shell: mix local.hex --force
15+
args:
16+
creates: /home/vagrant/.mix/archives/hex.ez
17+
18+
- name: install phoenix
19+
sudo_user: vagrant
20+
sudo: yes
21+
shell: mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v0.13.0/phoenix_new-0.13.0.ez --force
22+
args:
23+
creates: /home/vagrant/.mix/archives/phoenix_new-0.13.0.ez
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
postgresql:
3+
ipv4_trust: 127.0.0.1/32
4+
listen: localhost
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: restart postgresql
3+
service: name=postgresql state=restarted enabled=yes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
- name: install packages
3+
apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600
4+
with_items:
5+
- postgresql
6+
- libpq-dev
7+
# postgresql package requires correct locale when installing
8+
environment:
9+
LC_ALL: en_US.UTF-8
10+
11+
- name: install norwegian locale
12+
apt: pkg=language-pack-nb state=latest
13+
notify:
14+
- restart postgresql
15+
16+
- name: ensure postgresql is running
17+
service: name=postgresql state=running enabled=yes
18+
19+
# Ensure that postgresql is restarted before we create databases and users
20+
- meta: flush_handlers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test -s /vagrant/venv/bin/activate && source /vagrant/venv/bin/activate
2+
cd /vagrant

provisioning/roles/vagrant/files/env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Defaults env_keep += "SSH_AUTH_SOCK"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
- name: ensure sudo keeps SSH_AUTH_SOCK in environment
3+
copy: src=env
4+
dest=/etc/sudoers.d/env
5+
mode=0440
6+
owner=root
7+
group=root
8+
9+
- name: add host keys for github.com and bitbucket.org
10+
copy: src=ssh_known_hosts
11+
dest=/etc/ssh/ssh_known_hosts
12+
mode=0644
13+
owner=root
14+
group=root
15+
16+
- name: hide login message
17+
copy: dest=/home/vagrant/.hushlogin
18+
content=
19+
owner=vagrant
20+
group=vagrant
21+
mode=0644
22+
23+
- name: install bash_profile
24+
copy: src=dot.bash_profile
25+
dest=/home/vagrant/.bash_profile
26+
owner=vagrant
27+
group=vagrant
28+
mode=0644

0 commit comments

Comments
 (0)