Skip to content

Instantly share code, notes, and snippets.

@silenius
Last active May 15, 2018 09:23
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 silenius/14e5154362d366e3f7d861ab014a3239 to your computer and use it in GitHub Desktop.
Save silenius/14e5154362d366e3f7d861ab014a3239 to your computer and use it in GitHub Desktop.
salt% more states/pgbouncer/defaults.yaml
# vim: ts=2 sw=2
pgbouncer:
config:
pgbouncer:
logfile: /var/log/pgbouncer/pgbouncer.log
pidfile: /var/run/pgbouncer/pgbouncer.pid
listen_port: 6432
auth_type: md5
default_pool_size: 5
pool_mode: session
databases:
'*': auth_user = pgbouncer
####
salt% more states/pgbouncer/init.sls
include:
- pgbouncer.install
- pgbouncer.config
- pgbouncer.service
####
salt% more states/pgbouncer/config.sls
{% from "pgbouncer/map.jinja" import pgbouncer with context %}
include:
- pgbouncer.install
- pgbouncer.service
{% if pgbouncer.users is defined %}
pgbouncer_users:
file.managed:
- name: {{ pgbouncer.lookup.users }}
- user: {{ pgbouncer.lookup.user }}
- group: {{ pgbouncer.lookup.group }}
- mode: 640
- contents: |
{% for user, password in pgbouncer.users.items() %}
"{{ user }}" "{{ password }}"
{% endfor %}
- require:
- pkg: {{ pgbouncer.lookup.pkg }}
- require_in:
- ini: pgbouncer_ini
{% endif %}
pgbouncer_ini:
ini.options_present:
- name: {{ pgbouncer.lookup.config }}
- sections:
{{ pgbouncer.config|yaml(False)|indent(8) }}
- require:
- pkg: pgbouncer
- watch_in:
- service: pgbouncer_service
####
salt% salt chouffe.prod.lan state.show_sls pgbouncer
[WARNING ] Failed to open log file, do you have permission to write to /var/log/salt/master?
chouffe.prod.lan:
- Rendering SLS 'base:pgbouncer.config' failed: expected alphabetic or numeric character, but found '#'; line 29
---
[...]
pgbouncer_ini:
ini.options_present:
- name: /usr/local/etc/pgbouncer.ini
- sections:
databases:
&#39;*&#39;: auth_user = pgbouncer <======================
pgbouncer:
admin_users: admin
auth_type: md5
auth_user: pgbouncer
default_pool_size: 5
[...]
---
ERROR: Minions returned with non-zero exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment