diff --git a/.travis.yml b/.travis.yml index 7666b3d..7daa7c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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/ \ No newline at end of file + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/defaults/main.yml b/defaults/main.yml index 0dfc7b1..cfdb870 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -78,4 +78,5 @@ clickhouse_config: default_session_timeout: 60 clickhouse_dicts: [] - +clickhouse_default_user_profile: default +clickhouse_default_user_quota: default diff --git a/templates/users.j2 b/templates/users.j2 index 4ebf149..cceb013 100644 --- a/templates/users.j2 +++ b/templates/users.j2 @@ -43,8 +43,8 @@ {{ net }} {% endfor %} - {{ user.profile }} - {{ user.quota }} + {{ user.profile|default(clickhouse_default_user_profile) }} + {{ user.quota|default(clickhouse_default_user_quota) }} {% if user.dbs is defined %} {% for db in user.dbs %} diff --git a/tests/test.yml b/tests/test.yml index 77150c8..3bf8fa5 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -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 } @@ -62,4 +67,4 @@ attributes: - { name: testAttrName, type: String, null_value: "" } roles: - - ansible-clickhouse \ No newline at end of file + - ansible-clickhouse