From 6f9b17dc49f282c8df5a58467c5c33641133d413 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sun, 4 Oct 2015 14:20:44 +0200 Subject: [PATCH] setup salt provisioning for vagrant --- .gitignore | 1 + Vagrantfile | 28 ++++++++++------------------ salt/bootstrap.sh | 26 ++++++++++++++++++++++++++ salt/grains | 0 salt/minion | 11 +++++++++++ salt/pillar/top.sls | 0 salt/roots/base/init.sls | 6 ++++++ salt/roots/top.sls | 11 +++++++++++ salt/roots/vim/init.sls | 2 ++ 9 files changed, 67 insertions(+), 18 deletions(-) create mode 100755 salt/bootstrap.sh create mode 100644 salt/grains create mode 100644 salt/minion create mode 100644 salt/pillar/top.sls create mode 100644 salt/roots/base/init.sls create mode 100644 salt/roots/top.sls create mode 100644 salt/roots/vim/init.sls diff --git a/.gitignore b/.gitignore index ca72d2e..46f0db6 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ htmlcov/ tags _build/ *.mo +.vagrant/ diff --git a/Vagrantfile b/Vagrantfile index 2db2557..10854f0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/salt/bootstrap.sh b/salt/bootstrap.sh new file mode 100755 index 0000000..8f3f04f --- /dev/null +++ b/salt/bootstrap.sh @@ -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 <