<commit_before># -*- coding: utf-8 -*-
# vim: ft=sls

{% from "fail2ban/map.jinja" import fail2ban with context %}

fail2ban.config.fail2ban:
{% if fail2ban.config is defined %}

{% set fail2ban_config = fail2ban.config.get('source_path',
                           'salt://fail2ban/files/config.jinja') %}

    file.managed:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/fail2ban.local
        - source: {{ fail2ban_config }}
        - user: {{ fail2ban.user|default('root') }}
        - group: {{ fail2ban.group|default('root') }}
        - mode: '{{ fail2ban.mode|default("644") }}'
        - template: jinja
    {% if fail2ban.config.source_path is not defined %}
        - context:
            config:
                Definition: {{ fail2ban.config|yaml }}
    {% endif %}
{% else %}
    file.absent:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/fail2ban.local
{% endif %}
        - watch_in:
            - service: {{ fail2ban.service }}

fail2ban.config.jails:
{% if fail2ban.jails is defined %}

{% set fail2ban_jails = fail2ban.jails.get('source_path',
                          'salt://fail2ban/files/config.jinja') %}

    file.managed:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/jail.local
        - source: {{ fail2ban_jails }}
        - user: {{ fail2ban.user|default('root') }}
        - group: {{ fail2ban.group|default('root') }}
        - mode: '{{ fail2ban.mode|default("644") }}'
        - template: jinja
    {% if fail2ban.jails.source_path is not defined %}
        - context:
            config: {{ fail2ban.jails|yaml }}
    {% endif %}
{% else %}
    file.absent:
{% endif %}
        - watch_in:
            - service: {{ fail2ban.service }}

{% for name, options in fail2ban.get('actions', {})|dictsort %}

{% set fail2ban_actions = options.config.get('source_path',
                            'salt://fail2ban/files/config.jinja') %}<commit_msg>fix(config): add jails config filename also to fallback file.absent<commit_after># -*- coding: utf-8 -*-
# vim: ft=sls

{% from "fail2ban/map.jinja" import fail2ban with context %}

fail2ban.config.fail2ban:
{% if fail2ban.config is defined %}

{% set fail2ban_config = fail2ban.config.get('source_path',
                           'salt://fail2ban/files/config.jinja') %}

    file.managed:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/fail2ban.local
        - source: {{ fail2ban_config }}
        - user: {{ fail2ban.user|default('root') }}
        - group: {{ fail2ban.group|default('root') }}
        - mode: '{{ fail2ban.mode|default("644") }}'
        - template: jinja
    {% if fail2ban.config.source_path is not defined %}
        - context:
            config:
                Definition: {{ fail2ban.config|yaml }}
    {% endif %}
{% else %}
    file.absent:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/fail2ban.local
{% endif %}
        - watch_in:
            - service: {{ fail2ban.service }}

fail2ban.config.jails:
{% if fail2ban.jails is defined %}

{% set fail2ban_jails = fail2ban.jails.get('source_path',
                          'salt://fail2ban/files/config.jinja') %}

    file.managed:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/jail.local
        - source: {{ fail2ban_jails }}
        - user: {{ fail2ban.user|default('root') }}
        - group: {{ fail2ban.group|default('root') }}
        - mode: '{{ fail2ban.mode|default("644") }}'
        - template: jinja
    {% if fail2ban.jails.source_path is not defined %}
        - context:
            config: {{ fail2ban.jails|yaml }}
    {% endif %}
{% else %}
    file.absent:
        - name: {{ fail2ban.prefix }}/etc/fail2ban/jail.local
{% endif %}
        - watch_in:
            - service: {{ fail2ban.service }}

{% for name, options in fail2ban.get('actions', {})|dictsort %}

{% set fail2ban_actions = options.config.get('source_path',
                            'salt://fail2ban/files/config.jinja') %}
{'fraction_non_alphanumeric': 0.16735007688364942, 'fraction_numerical': 0.023577652485904665, 'mean_word_length': 2.222956234516928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3470427', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1271, 'n_words': 213}