summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorPetr Ospalý <p.ospaly@partner.samsung.com>2019-03-26 22:13:00 +0100
committerPetr Ospalý <p.ospaly@partner.samsung.com>2019-04-17 10:49:58 +0200
commit2bfe0f938efb70dba4454ea9a68a4af304fe6afc (patch)
treefc685202209e6cbd609822192cbf844edb4273f8 /ansible/roles
parent45fa0030abb4c013722f68c1ef23d53ba1d1620e (diff)
Add support for rancher 1.6 API
- New ansible module to handle rancher API - Setting up of the cattle db and log related options to achieve lower space usage. As of this moment it does what was intended: - it setups new values for db and log related options - it can be used for any other setting options Change-Id: I25048469df0cb035cc6eac39740210cdfa175ada Issue-ID: OOM-1681 Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com>
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/rancher/defaults/main.yml17
-rw-r--r--ansible/roles/rancher/tasks/rancher_server.yml23
2 files changed, 40 insertions, 0 deletions
diff --git a/ansible/roles/rancher/defaults/main.yml b/ansible/roles/rancher/defaults/main.yml
index 6ab52e64..67e581cd 100644
--- a/ansible/roles/rancher/defaults/main.yml
+++ b/ansible/roles/rancher/defaults/main.yml
@@ -4,3 +4,20 @@ rancher_remove_other_env: true
rancher_redeploy_k8s_env: true
rancher_cluster_health_state: healthy
rancher_cluster_health_check_retries: 30
+rancher:
+ # The following variables can be set via the UI under advanced/settings.
+ # All of these affect tables in the cattle db and are uninteresting
+ # to the user (they serve the internal logic of the cattle), but
+ # they can eat a lot of space when a deployment is busy or faulty.
+ #
+ # Audit-Log is the only user-facing option here and it is represented
+ # in the UI.
+ #
+ # Auto-purge deleted entries from most tables after this long (seconds)
+ main_tables_purge_after_seconds: 28800 # 8 hours
+ # Auto-purge Event entries after this long (seconds)
+ events_purge_after_seconds: 28800 # 8 hours
+ # Auto-purge Service Log entries after this long (seconds)
+ service_log_purge_after_seconds: 86400 # 1 day
+ # Auto-purge Audit Log entries after this long (seconds)
+ audit_log_purge_after_seconds: 2592000 # 30 days
diff --git a/ansible/roles/rancher/tasks/rancher_server.yml b/ansible/roles/rancher/tasks/rancher_server.yml
index e1eb5a5d..add7b3c9 100644
--- a/ansible/roles/rancher/tasks/rancher_server.yml
+++ b/ansible/roles/rancher/tasks/rancher_server.yml
@@ -39,3 +39,26 @@
key_private: "{{ env.data.apikey.private }}"
rancher_agent_image: "{{ env.data.registration_tokens.image }}"
rancher_agent_reg_url: "{{ env.data.registration_tokens.reg_url }}"
+
+- name: Configure the size of the rancher cattle db and logs
+ block:
+ - name: Main tables
+ rancher1_api:
+ server: "{{ rancher_server_url }}"
+ option: main_tables.purge.after.seconds
+ value: "{{ rancher.main_tables_purge_after_seconds }}"
+ - name: Events
+ rancher1_api:
+ server: "{{ rancher_server_url }}"
+ option: events.purge.after.seconds
+ value: "{{ rancher.events_purge_after_seconds }}"
+ - name: Service log
+ rancher1_api:
+ server: "{{ rancher_server_url }}"
+ option: service_log.purge.after.seconds
+ value: "{{ rancher.service_log_purge_after_seconds }}"
+ - name: Audit log
+ rancher1_api:
+ server: "{{ rancher_server_url }}"
+ option: audit_log.purge.after.seconds
+ value: "{{ rancher.audit_log_purge_after_seconds }}"