Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#
# Mark Lopez (Silvenga) <m@silvenga.com>
# https://silvenga.com
#
{% set requirements = ['jinja2', 'flask', 'flask-wtf', 'requests', 'pymongo', 'werkzeug==0.9.4', 'cherrypy'] %}
{% set install_path = '/opt/saltpad' %}
{% set git_rev = 'f62809f6a854b9e9d49bd1534b09b7943abec354' %}
{% set api_url = 'https://YOURSALTMASTER.net' %}
{% set secret_key = '' %}
pip: # Installing manually due to an Ubuntu 14.04 pkg issue
cmd.run:
- name: python <(wget -qO- https://raw.github.com/pypa/pip/master/contrib/get-pip.py)
- unless: which pip
{% for project in requirements %}
saltpad pip {{ project }}:
pip.installed:
- name: {{ project }}
- require:
- cmd: pip
- require_in:
- git: saltpad repo
{% endfor %}
saltpad pkgs:
pkg.installed:
- pkgs:
- git
- salt-api
saltapi config:
file.managed:
- name: /etc/salt/master.d/salt-api.conf
- contents: |
rest_cherrypy:
port: 8000
host: 127.0.0.1
disable_ssl: true
- require:
- pkg: saltpad pkgs
saltapi service:
service.running:
- name: salt-api
- enable: true
- watch:
- file: saltapi config
- require:
- pkg: saltpad pkgs
saltpad repo:
git.latest:
- name: https://github.com/tinyclues/saltpad.git
- rev: {{ git_rev }}
- target: {{ install_path }}
- require:
- pkg: saltpad pkgs
saltpad config:
file.managed:
- name: {{ install_path }}/saltpad/local_settings.py
- require:
- git: saltpad repo
- contents: |
# TODO: If salt-master is not in localhost, uncomment and change API URL
#API_URL = '{{ api_url }}'
# TODO: Generate a random key with os.urandom(24)
SECRET_KEY = '{{ secret_key }}'
# Uncomment next line if you want to add sentry support
# You'll also need to install raven[flask]
# SENTRY_DSN = "https://YOUR_SENTRY_DSN"
# Uncomment next line if your API use a self-signed HTTPS certificate
# VERIFY_SSL = False
# You can make saltpad bind 0.0.0.0 (all server address) but you should
# only bind 0.0.0.0 for testing purposes, you should really deploy
# saltpad in production using a wsgi server (like gunicorn or chaussette)
# behind nginx, you have been warned!
# HOST = "0.0.0.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment