Last active
August 29, 2015 14:05
-
-
Save StanAngeloff/5a2a95752e2f6c571668 to your computer and use it in GitHub Desktop.
Ansible dictionary merge, can be used to allow inventory/hosts/groups to override defaults
This file contains hidden or 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
--- | |
- name: Create PgBouncer configuration | |
sudo: true | |
ini_file: > | |
backup=yes | |
dest=/etc/pgbouncer/pgbouncer.ini | |
section=pgbouncer | |
option="{{ item.key }}" | |
value="{{ item.value }}" | |
state="{% if item.value != None %}present{% else %}absent{% endif %}" | |
owner=postgres group=postgres | |
mode=0640 | |
# Merge pgbouncer_defaults with pgbouncer_configuration | |
with_dict: "{% set merged = ( pgbouncer_defaults | default({}) ) %}{% set noop = merged.update( pgbouncer_configuration | default({}) ) %}{{ merged }}" | |
notify: restart pgbouncer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment