Use salt for provisioning

This commit is contained in:
Martin Polden 2014-12-22 00:19:01 +01:00
parent bea550f669
commit 959c0a8360
16 changed files with 60 additions and 75 deletions

18
Vagrantfile vendored
View File

@ -2,17 +2,15 @@
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64-current"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 8080, host: 5000
config.vm.network :private_network, ip: "172.16.5.10"
config.vm.synced_folder ".", "/vagrant", nfs: true
config.ssh.forward_agent = true
config.vm.box = "chef/ubuntu-14.04"
config.vm.synced_folder ".", "/vagrant"
config.vm.synced_folder "salt/roots/", "/srv/salt/"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--memory", "512"]
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/playbook.yml"
ansible.inventory_path = "provisioning/development"
config.vm.provision :salt do |salt|
salt.minion_config = "salt/minion.yml"
salt.run_highstate = true
salt.colorize = true
end
end

View File

@ -1,2 +0,0 @@
[development]
172.16.5.10

View File

@ -1,7 +0,0 @@
---
- hosts: development
sudo: yes
roles:
- ntp
- golang
- vagrant

View File

@ -1,11 +0,0 @@
---
- name: install golang
shell: curl https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz | tar -zxC /usr/local
creates=/usr/local/go
- name: configure path
copy: src=golang.sh
dest=/etc/profile.d/golang.sh
owner=root
group=root
mode=0644

View File

@ -1 +0,0 @@
Europe/Oslo

View File

@ -1,3 +0,0 @@
---
- name: update timezone
command: dpkg-reconfigure --frontend=noninteractive tzdata

View File

@ -1,15 +0,0 @@
---
- name: set timezone
copy: src=timezone
dest=/etc/timezone
owner=root
group=root
mode=0644
notify:
- update timezone
- name: install ntp
apt: pkg=ntp state=latest
- name: make sure ntp is running
service: name=ntp state=running enabled=yes

View File

@ -1,2 +0,0 @@
export GOPATH=/vagrant
cd /vagrant

View File

@ -1,24 +0,0 @@
---
- name: install packages
apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600
with_items:
- gdb
- git
- make
- mercurial
environment:
LANG: en_US.UTF-8
- name: hide login message
copy: dest=/home/vagrant/.hushlogin
content=
owner=vagrant
group=vagrant
mode=0644
- name: install bash_profile
copy: src=dot.bash_profile
dest=/home/vagrant/.bash_profile
owner=vagrant
group=vagrant
mode=0644

1
salt/minion.yml Normal file
View File

@ -0,0 +1 @@
file_client: local

20
salt/roots/dev.sls Normal file
View File

@ -0,0 +1,20 @@
packages:
pkg.installed:
- pkgs:
- git
- make
- mercurial
/home/vagrant/.hushlogin:
file.managed:
- contents: ""
- user: vagrant
- group: vagrant
- mode: 0644
/home/vagrant/.bash_profile:
file.managed:
- source: salt://files/dot.bash_profile
- user: vagrant
- group: vagrant
- mode: 0644

View File

@ -0,0 +1,4 @@
test -d $HOME/.local/bin || mkdir -p $HOME/.local/bin
export PATH=/vagrant/bin:$HOME/.local/bin:$PATH
export GOPATH=/vagrant
cd /vagrant

14
salt/roots/golang.sls Normal file
View File

@ -0,0 +1,14 @@
curl:
pkg:
- installed
curl -L https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz | tar -zxC /usr/local:
cmd.run:
- unless: test -d /usr/local/go
/etc/profile.d/golang.sh:
file.managed:
- source: salt://files/golang.sh
- user: root
- group: root
- mode: 0644

7
salt/roots/ntp.sls Normal file
View File

@ -0,0 +1,7 @@
Europe/Oslo:
timezone.system
ntp:
pkg:
- installed
service:
- running

6
salt/roots/top.sls Normal file
View File

@ -0,0 +1,6 @@
---
base:
'*':
- ntp
- dev
- golang