# {{ ansible_managed }}

net:
  bindIp: '127.0.0.1'
  {% if mongodb_major_version is version("3.6", "<") -%}
  http:
    enabled: {{ mongodb_net_http_enabled | to_nice_json }}
  {% endif -%}
  ipv6: {{ mongodb_net_ipv6 | to_nice_json }}
  maxIncomingConnections: {{ mongodb_net_maxconns }}
  port: {{ mongodb_net_port }}

processManagement:
  fork: {{ mongodb_processmanagement_fork | to_nice_json }}
  {% if mongodb_pidfile_path is defined and mongodb_pidfile_path != '' -%}
  pidFilePath: {{ mongodb_pidfile_path }}
  {% endif %}

security:
  authorization: 'disabled'

storage:
  dbPath: {{ mongodb_storage_dbpath }}
  directoryPerDB: {{ mongodb_storage_dirperdb | to_nice_json }}
  engine: {{ mongodb_storage_engine }}
  journal:
    enabled: {{ mongodb_storage_journal_enabled | to_nice_json }}
  {% if mongodb_storage_engine == 'mmapv1' -%}
  mmapv1:
    quota:
      enforced: {{ mongodb_storage_quota_enforced | to_nice_json }}
      maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
    smallFiles: {{ mongodb_storage_smallfiles | to_nice_json }}
  {% endif -%}
  {% if mongodb_storage_engine == 'wiredTiger' -%}
  wiredTiger:
    engineConfig:
      {% if mongodb_wiredtiger_cache_size is defined -%}
      cacheSizeGB: {{ mongodb_wiredtiger_cache_size }}
      {% endif -%}
      directoryForIndexes: {{ mongodb_wiredtiger_directory_for_indexes | to_nice_json }}
  {% endif %}

systemLog:
  destination: {{ mongodb_systemlog_destination }}
  {% if mongodb_systemlog_destination == 'file' -%}
  logAppend: {{ mongodb_systemlog_logappend | to_nice_json }}
  logRotate: {{ mongodb_systemlog_logrotate }}
  path: {{ mongodb_systemlog_path }}
  {% endif -%}
