Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Use default values for users quota and profile #14

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ script:
- clickhouse-client -q 'select 1' -d testu1
- clickhouse-client -q 'select 1' -d testu2 -u testuser2 --password testplpassword
- clickhouse-client -q 'select 1' -d testu3
- clickhouse-client -q 'select 1' -d testu3 -u testuser_for_defaults --password testplpassword
#Full remove check
- ansible-playbook tests/test.yml -i tests/inventory -e "clickhouse_remove=yes clickhouse_remove_full=yes" -v


notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
webhooks: https://galaxy.ansible.com/api/v1/notifications/
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ clickhouse_config:
default_session_timeout: 60

clickhouse_dicts: []

clickhouse_default_user_profile: default
clickhouse_default_user_quota: default
4 changes: 2 additions & 2 deletions templates/users.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<ip>{{ net }}</ip>
{% endfor %}
</networks>
<profile>{{ user.profile }}</profile>
<quota>{{ user.quota }}</quota>
<profile>{{ user.profile|default(clickhouse_default_user_profile) }}</profile>
<quota>{{ user.quota|default(clickhouse_default_user_quota) }}</quota>
{% if user.dbs is defined %}
<allow_databases>
{% for db in user.dbs %}
Expand Down
7 changes: 6 additions & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
quota: "default",
dbs: {testu1,testu2,testu3} ,
comment: "classic user with multi dbs and multi-custom network allow password"}
- { name: "testuser_for_defaults",
password: "testplpassword",
networks: { 192.168.0.0/24, 10.0.0.0/8 },
dbs: {testu1,testu2,testu3} ,
comment: "User with default profile and password"}
clickhouse_dbs_custom:
- { name: testu1 }
- { name: testu2 }
Expand Down Expand Up @@ -62,4 +67,4 @@
attributes:
- { name: testAttrName, type: String, null_value: "" }
roles:
- ansible-clickhouse
- ansible-clickhouse