Skip to content

Instantly share code, notes, and snippets.

@copelco
Last active December 22, 2015 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save copelco/6528865 to your computer and use it in GitHub Desktop.
Save copelco/6528865 to your computer and use it in GitHub Desktop.
mine_interfaces:
match: '*'
function:
mine.send:
- network.interfaces
db:
match: '*db*'
require:
- mine_interfaces
sls:
- postgresql.project
- postgresql.ufw
app:
match: '*web*'
require:
- db
sls:
- pgbouncer
; hiii
{% for host, ifaces in salt['mine.get']('{{ target }}', 'network.interfaces').iteritems() %}
{% set host_addr = ifaces.get('{{ interface }}', {}).get('inet', [{}])[0].get('address') %}
{{ pillar['project_name'] }}_{{ pillar['environment'] }} = host={{ address }}
{% endfor %}
postgresql-client:
pkg:
- installed
pgbouncer:
pkg:
- installed
- require:
- pkg: postgresql-client
service:
- running
- enable: True
pgbouncer_ini:
file.managed:
- name: /etc/pgbouncer/pgbouncer.ini
- source: salt://pgbouncer/pgbouncer.ini
- user: root
- group: root
- mode: 0640
- template: jinja
- context:
target: '*db*'
interface: pillar['primary_iface']
- require:
- pkg: pgbouncer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment