diff --git a/states/clickhouse/config.sls b/states/clickhouse/config.sls
index 75edb1b..18d1b56 100644
--- a/states/clickhouse/config.sls
+++ b/states/clickhouse/config.sls
@@ -1,5 +1,9 @@
{%- from "clickhouse/map.jinja" import clickhouse with context -%}
---
+clickhouse-config-folder:
+ file.directory:
+ - name: /etc/clickhouse-server/config.d
+
clickhouse-config-file-settings:
file.managed:
- name: /etc/clickhouse-server/config.d/settings.xml
diff --git a/states/clickhouse/templates/keeper.xml.j2 b/states/clickhouse/templates/keeper.xml.j2
index db73031..eaab661 100644
--- a/states/clickhouse/templates/keeper.xml.j2
+++ b/states/clickhouse/templates/keeper.xml.j2
@@ -5,30 +5,32 @@
{{ nodename }}
9281
- 1
{%- endfor %}
- 9281
+ 9281
{{ clickhouse.clusters[clickhouse.cluster].nodes[salt['grains.get']('fqdn')].id }}
/var/lib/clickhouse/coordination/log
/var/lib/clickhouse/coordination/snapshots
+ false
10000
30000
- fatal
+ trace
- true
+ false
{%- for nodename, settings in clickhouse.clusters[clickhouse.cluster].nodes.items() %}
+{%- if settings.keeper|default(false) %}
{{ settings.id }}
{{ nodename }}
9444
+{%- endif %}
{%- endfor %}
diff --git a/states/clickhouse/templates/replica.xml.j2 b/states/clickhouse/templates/replica.xml.j2
index 56bc2c9..bbed9e0 100644
--- a/states/clickhouse/templates/replica.xml.j2
+++ b/states/clickhouse/templates/replica.xml.j2
@@ -5,6 +5,7 @@
false
{% for nodename, settings in clickhouse.clusters[clickhouse.cluster].nodes.items() %}
+{%- if settings.replica|default(false) %}
{{ nodename }}
9440
@@ -12,6 +13,7 @@
1
+{%- endif %}
{% endfor %}
{{ clickhouse.cluster }}>
diff --git a/states/clickhouse/templates/settings.xml.j2 b/states/clickhouse/templates/settings.xml.j2
index 0ba2c77..242a1b4 100644
--- a/states/clickhouse/templates/settings.xml.j2
+++ b/states/clickhouse/templates/settings.xml.j2
@@ -5,8 +5,8 @@
/clickhouse/{cluster}/tables/{uuid}/{database}/{table}-{shard}
warning
- /var/log/clickhouse-server/clickhouse-server-%F-%T.log
- /var/log/clickhouse-server/clickhouse-server-%F-%T.err.log
+ /var/log/clickhouse-server/clickhouse-server.log
+ /var/log/clickhouse-server/clickhouse-server.err.log
10
100M
1
diff --git a/states/clickhouse/templates/user.xml.j2 b/states/clickhouse/templates/user.xml.j2
index cd43562..abff9ed 100644
--- a/states/clickhouse/templates/user.xml.j2
+++ b/states/clickhouse/templates/user.xml.j2
@@ -2,11 +2,13 @@
<{{ name }}>
+{%- if params.networks|default(None) %}
{%- for network in params.networks|default(["127.0.0.1/8"]) %}
{{ network }}
{%- endfor %}
+{%- endif %}
{{ params.profile|default("default") }}
{{ params.quota|default("default") }}
{{ params.default_database|default("default") }}
diff --git a/states/clickhouse/users.sls b/states/clickhouse/users.sls
index 472be8c..592cd57 100644
--- a/states/clickhouse/users.sls
+++ b/states/clickhouse/users.sls
@@ -1,5 +1,9 @@
---
{%- from "clickhouse/map.jinja" import clickhouse with context %}
+clickhouse-users-folder:
+ file.directory:
+ - name: /etc/clickhouse-server/users.d
+
{% for user, params in clickhouse.users.items() %}
clickhouse-user-{{ user }}:
file.managed: