From 9dee2011bf2eeddf43c4479935a5219c818e1cfb Mon Sep 17 00:00:00 2001 From: Petr OspalĂ˝ Date: Fri, 5 Apr 2019 09:57:03 +0200 Subject: Refactor rancher1_api module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This rewrite enables to add easier more features supported by the rancher API. The initial idea of a simple get and set through the JSON REST API is not feasible. To achieve something with the API one may have to setup more options on different URLs and in a particular order. For this reason the module comes with the mechanism of "modes", which is a wrapper around some feature in the rancher and which can require multiple steps to do. Rancher1_api module could also support "raw" mode where the user will not be limited by a few implemented modes in the module, but he can craft all requests by hand - but due to the fact that such thing can be done easily with just curl command and ansible shell module, there is no benefit in doing so. Especially when rancher 1.6 is already obsoleted within the ONAP. The useful value of this module is to give the user a simple means to set something in the rancher and hide all the boilerplate from him via a mode. - Original logic was rewritten to utilize the "mode" mechanism. - New module structure is also easier to test outside of ansible. Issue-ID: OOM-1681 Change-Id: I0e7932199df9ec1acd80af545060199867ad17fa Signed-off-by: Petr OspalĂ˝ --- ansible/roles/rancher/tasks/rancher_server.yml | 28 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'ansible/roles/rancher/tasks') diff --git a/ansible/roles/rancher/tasks/rancher_server.yml b/ansible/roles/rancher/tasks/rancher_server.yml index add7b3c9..b71bf8d1 100644 --- a/ansible/roles/rancher/tasks/rancher_server.yml +++ b/ansible/roles/rancher/tasks/rancher_server.yml @@ -45,20 +45,32 @@ - name: Main tables rancher1_api: server: "{{ rancher_server_url }}" - option: main_tables.purge.after.seconds - value: "{{ rancher.main_tables_purge_after_seconds }}" + account_key: "{{ key_public }}:{{ key_private }}" + mode: settings + data: + 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 }}" + account_key: "{{ key_public }}:{{ key_private }}" + mode: settings + data: + 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 }}" + account_key: "{{ key_public }}:{{ key_private }}" + mode: settings + data: + 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 }}" + account_key: "{{ key_public }}:{{ key_private }}" + mode: settings + data: + option: audit_log.purge.after.seconds + value: "{{ rancher.audit_log_purge_after_seconds }}" -- cgit 1.2.3-korg