Created
August 3, 2015 14:20
-
-
Save silenius/9d466e17c4a4e6f38ca4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include: | |
- users.webapps.{{ user }} | |
- venvs.webapps.{{ venv }} | |
- repos.webapps.{{ repo }} | |
{% set cfg = salt['bbpf_webapp.config'](name) %} | |
########### | |
# UNICORN # | |
########### | |
{% if cfg.unicorn_config %} | |
{{ name }}_config: | |
file.managed: | |
- name: {{ cfg.unicorn_config._fullpath }} | |
- source: salt://webapps/files/{{ cfg.unicorn_config._template }} | |
- template: jinja | |
- mode: 400 | |
- user: {{ cfg.user }} | |
- context: | |
cfg: {{ cfg.unicorn_config }} | |
########## | |
# PASTER # | |
########## | |
{% elif cfg.paster_config %} | |
{{ name }}_config: | |
file.managed: | |
- name: {{ cfg.paster_config._fullpath }} | |
- source: salt://webapps/files/{{ cfg.paster_config._template }} | |
- template: jinja | |
- mode: 400 | |
- user: {{ cfg.user }} | |
- context: | |
cfg: {{ cfg.paster_config }} | |
deploy: {{ cfg.deploy }} | |
name: {{ cfg.name }} | |
{% endif %} | |
################# | |
# RUBY ON RAILS # | |
################# | |
{% if 'rails' in cfg.use %} | |
{{ name }}_rails_db: | |
file.managed: | |
- name: {{ cfg.rails._db_fullpath }} | |
- source: salt://webapps/files/rails_database.yml.jinja | |
- template: jinja | |
- mode: 400 | |
- user: {{ cfg.user }} | |
- context: | |
db: {{ cfg.pgsql }} | |
{{ name }}_rails_smtp: | |
file.blockreplace: | |
- name: {{ cfg.rails._cfgenv_fullpath }} | |
- marker_start: "# START managed zone Rails Mailer -DO-NOT-REMOVE-" | |
- marker_end: "# END managed zone Rails Mailer --" | |
{{ name }}_rails_smtp_accumulator: | |
file.accumulated: | |
- filename: {{ cfg.rails._cfgenv_fullpath }} | |
- text: | | |
config.action_mailer.smtp_settings = { | |
:address => "{{ cfg.deploy.smtp_server }}", | |
:port => {{ cfg.deploy.smtp_port }}, | |
:domain => "{{ cfg.deploy.smtp_HELO }}", | |
:openssl_verify_mode => "none" | |
:enable_starttls_auto => true | |
} | |
- require_in: | |
- file: {{ name }}_rails_smtp | |
{% endif %} | |
############### | |
# DAEMONTOOLS # | |
############### | |
{% if cfg.supervise %} | |
daemontools: | |
pkg.installed | |
{{ name }}_supervise: | |
file.managed: | |
- name: {{ cfg.supervise._fullpath }} | |
- source: salt://webapps/files/{{ cfg.supervise._template }} | |
- user: root | |
- group: wheel | |
- mode: 754 | |
- template: jinja | |
- makedirs: True | |
- dir_mode: 755 | |
- context: | |
cfg: {{ cfg }} | |
- watch: | |
- file: {{ name }}_config | |
- require: | |
- pkg: daemontools | |
{{ name }}_supervise_service: | |
service.running: | |
- name: {{ cfg.name }} | |
- provider: daemontools | |
- watch: | |
- file: {{ name }}_supervise | |
{% endif %} | |
############## | |
# POSTGRESQL # | |
############## | |
{% if cfg.pgsql %} | |
{{ name }}_pgsql_user: | |
postgres_user.present: | |
- name: {{ cfg.pgsql.username }} | |
- password: {{ cfg.pgsql.password }} | |
- login: True | |
- superuser: False | |
- db_user: pgsql | |
- db_host: 10.209.1.10 | |
{{ name }}_pgsql_database: | |
postgres_database.present: | |
- name: {{ cfg.pgsql.db.name }} | |
- owner: {{ cfg.pgsql.db.owner }} | |
- db_user: pgsql | |
- db_host: 10.209.1.10 | |
- require: | |
- postgres_user: {{ name }}_pgsql_user | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment