setup salt provisioning for vagrant
This commit is contained in:
parent
11b1befa1b
commit
6f9b17dc49
9 changed files with 67 additions and 18 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -44,3 +44,4 @@ htmlcov/
|
|||
tags
|
||||
_build/
|
||||
*.mo
|
||||
.vagrant/
|
||||
|
|
28
Vagrantfile
vendored
28
Vagrantfile
vendored
|
@ -22,7 +22,7 @@ Vagrant.configure(2) do |config|
|
|||
# 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,
|
||||
# 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
|
||||
# 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
|
||||
# argument is a set of non-required options.
|
||||
# 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
|
||||
# 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:
|
||||
vb.memory = "1024"
|
||||
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
|
||||
# such as FTP and Heroku are also available. See the documentation at
|
||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
||||
# config.push.define "atlas" do |push|
|
||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
||||
# 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
|
||||
config.vm.provision :salt do |salt|
|
||||
salt.bootstrap_script = "salt/bootstrap.sh"
|
||||
salt.minion_id = "gvadev"
|
||||
salt.masterless = true
|
||||
salt.run_highstate = true
|
||||
salt.colorize = true
|
||||
end
|
||||
end
|
||||
|
|
26
salt/bootstrap.sh
Executable file
26
salt/bootstrap.sh
Executable 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
0
salt/grains
Normal file
11
salt/minion
Normal file
11
salt/minion
Normal 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
0
salt/pillar/top.sls
Normal file
6
salt/roots/base/init.sls
Normal file
6
salt/roots/base/init.sls
Normal file
|
@ -0,0 +1,6 @@
|
|||
base-packages:
|
||||
pkg.installed:
|
||||
- names:
|
||||
- screen
|
||||
- htop
|
||||
- git
|
11
salt/roots/top.sls
Normal file
11
salt/roots/top.sls
Normal 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
2
salt/roots/vim/init.sls
Normal file
|
@ -0,0 +1,2 @@
|
|||
vim-nox:
|
||||
pkg.installed
|
Loading…
Reference in a new issue