summaryrefslogtreecommitdiffstats
path: root/ansible/roles/rancher
diff options
context:
space:
mode:
authorPetr Ospalý <p.ospaly@partner.samsung.com>2019-04-05 09:57:03 +0200
committerPetr Ospalý <p.ospaly@partner.samsung.com>2019-04-17 10:49:58 +0200
commit9dee2011bf2eeddf43c4479935a5219c818e1cfb (patch)
tree73d32953d9f210d1ba1507e71125031096624900 /ansible/roles/rancher
parent2bfe0f938efb70dba4454ea9a68a4af304fe6afc (diff)
Refactor rancher1_api module
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ý <p.ospaly@partner.samsung.com>
Diffstat (limited to 'ansible/roles/rancher')
-rw-r--r--ansible/roles/rancher/tasks/rancher_server.yml28
1 files changed, 20 insertions, 8 deletions
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 }}"