Skip to content

Instantly share code, notes, and snippets.

@eykd
Last active February 19, 2016 17:36
Show Gist options
  • Save eykd/45d540f6eb3bca56563e to your computer and use it in GitHub Desktop.
Save eykd/45d540f6eb3bca56563e to your computer and use it in GitHub Desktop.
Demonstrating a potential bug in git.latest
fileserver_backend:
- roots
file_client: local
file_roots:
base:
- /opt/salt
pillar_roots:
base:
- /srv
git:
pkg.installed
webapps-group:
group.present:
- name: webapps
django-group:
group.present:
- name: django
django-user:
user.present:
- name: django
- groups:
- django
- require:
- group: django-group
github.com:
ssh_known_hosts:
- present
- user: django
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- require:
- user: django-user
/opt:
file.directory:
- user: root
- group: root
/opt/stuff:
file.directory:
- user: root
- group: webapps
- mode: 775
- require:
- file: /opt
- group: webapps-group
/opt/stuff/django:
file.directory:
- user: django
- group: django
- require:
- user: django-user
django:
git.latest:
- name: https://github.com/django/django.git
- rev: stable/1.5.x
- force_checkout: true
- force_clone: true
- force_fetch: true
- force_reset: true
- target: /opt/stuff/django
- user: django
- require:
- pkg: git
- ssh_known_hosts: github.com
- file: /opt/stuff/django
#!/bin/sh
start_seconds="$(date +%s)"
if [ ! -d "/etc/salt" ]; then
echo "Bootstrap salt"
sudo wget -O /root/install_salt.sh https://bootstrap.saltstack.com
sudo sh /root/install_salt.sh -P git v2015.8.5
fi
sudo mkdir -p /etc/salt
sudo cp /vagrant/minion.conf /etc/salt/minion
echo "Restart salt-minion"
sudo salt-minion -d
sudo service salt-minion restart
echo "Executing salt highstate (provisioning)"
sudo salt-call state.highstate
end_seconds="$(date +%s)"
echo "-----------------------------"
echo "Provisioning complete in "$(expr $end_seconds - $start_seconds)" seconds"
base:
'*':
- my-env
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :salt_testbed do |web|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
web.vm.box = "ubuntu/trusty64"
# Share for masterless salt minion
web.vm.synced_folder "./", "/opt/salt"
web.vm.provision :shell, path: "provision_salt.sh", privileged: false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment