Skip to content

Instantly share code, notes, and snippets.

@jpic
Created June 25, 2015 08:51
Show Gist options
  • Save jpic/4a397a068e78cf3c2f53 to your computer and use it in GitHub Desktop.
Save jpic/4a397a068e78cf3c2f53 to your computer and use it in GitHub Desktop.
YAML+Jinja code readability
{%- if something %}
{%- for name, data in groups %}
{{ name }}:
{%- if data.get('absent', False) %}
group.absent:
{%- else %}
group.present:
{%- endif %}
{%- if 'gid' in data %}
- gid: {{ data.gid }}
{%- endif %}
{%- if data.get('absent', False) %}
- purge: True
{%- endif %}
{%- endfor %}
{%- endif %}
groups:
admin:
absent: True
sudo:
gid: 4000
sudo:
group.present:
- gid: 4000
admin:
group.absent:
- purge: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment