setup salt provisioning for vagrant

This commit is contained in:
Jan Dittberner 2015-10-04 14:20:44 +02:00
parent 11b1befa1b
commit 6f9b17dc49
9 changed files with 67 additions and 18 deletions

1
.gitignore vendored
View file

@ -44,3 +44,4 @@ htmlcov/
tags tags
_build/ _build/
*.mo *.mo
.vagrant/

28
Vagrantfile vendored
View file

@ -22,7 +22,7 @@ Vagrant.configure(2) do |config|
# Create a forwarded port mapping which allows access to a specific port # Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below, # 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. # 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: 443, host: 8443
# Create a private network, which allows host-only access to the machine # Create a private network, which allows host-only access to the machine
# using a specific IP. # using a specific IP.
@ -38,6 +38,8 @@ Vagrant.configure(2) do |config|
# the path on the guest to mount the folder. And the optional third # the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options. # argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data" # config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder "salt/roots/", "/srv/salt/"
config.vm.synced_folder "salt/pillar/", "/srv/pillar/"
# Provider-specific configuration so you can fine-tune various # Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options. # backing providers for Vagrant. These expose provider-specific options.
@ -50,22 +52,12 @@ Vagrant.configure(2) do |config|
# # Customize the amount of memory on the VM: # # Customize the amount of memory on the VM:
vb.memory = "1024" vb.memory = "1024"
end end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies config.vm.provision :salt do |salt|
# such as FTP and Heroku are also available. See the documentation at salt.bootstrap_script = "salt/bootstrap.sh"
# https://docs.vagrantup.com/v2/push/atlas.html for more information. salt.minion_id = "gvadev"
# config.push.define "atlas" do |push| salt.masterless = true
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" salt.run_highstate = true
# end salt.colorize = true
end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end end

26
salt/bootstrap.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh -
# We just download the bootstrap script by default and execute that.
if [ -x /usr/bin/fetch ]; then
/usr/bin/fetch -o - https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@"
elif [ -x /usr/bin/curl ]; then
/usr/bin/curl -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@"
else
python \
-c 'import urllib; print urllib.urlopen("https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh").read()' \
| sh -s -- "$@"
fi
cat >/etc/salt/minion <<EOF
file_client: local
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
log_file: file:///dev/log
EOF

0
salt/grains Normal file
View file

11
salt/minion Normal file
View file

@ -0,0 +1,11 @@
file_client: local
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
log_file: file:///dev/log

0
salt/pillar/top.sls Normal file
View file

6
salt/roots/base/init.sls Normal file
View file

@ -0,0 +1,6 @@
base-packages:
pkg.installed:
- names:
- screen
- htop
- git

11
salt/roots/top.sls Normal file
View file

@ -0,0 +1,11 @@
base:
'*':
- vim
- base
{% if 'roles' in grains %}
{% for role in grains['roles'] %}
'roles:{{ role }}':
- match: grain
- {{ role }}
{% endfor %}
{% endif %}

2
salt/roots/vim/init.sls Normal file
View file

@ -0,0 +1,2 @@
vim-nox:
pkg.installed