From 67944988935b068006018a0f43e9e747cdc7653b Mon Sep 17 00:00:00 2001 From: Keshav Prasad Date: Tue, 30 Aug 2022 01:52:47 +0530 Subject: [PATCH] fix: interim commit --- ansible/es.yml | 8 ++++---- ansible/roles/es-azure-snapshot/defaults/main.yml | 7 ++++++- ansible/roles/es-azure-snapshot/tasks/main.yml | 12 ++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ansible/es.yml b/ansible/es.yml index e9ba5ff8ac..b1c45b6a1f 100644 --- a/ansible/es.yml +++ b/ansible/es.yml @@ -8,10 +8,10 @@ roles: - role: es-azure-snapshot when: cloud_provider == "azure" - - role: es-aws-snapshot - when: cloud_provider == "aws" - - role: es-gcloud-snapshot - when: cloud_provider == "gcloud" +# - role: es-aws-snapshot +# when: cloud_provider == "aws" +# - role: es-gcloud-snapshot +# when: cloud_provider == "gcloud" - role: es5-snapshot-purge tags: - es_backup diff --git a/ansible/roles/es-azure-snapshot/defaults/main.yml b/ansible/roles/es-azure-snapshot/defaults/main.yml index f187fad584..d83e6b461e 100644 --- a/ansible/roles/es-azure-snapshot/defaults/main.yml +++ b/ansible/roles/es-azure-snapshot/defaults/main.yml @@ -9,4 +9,9 @@ snapshot_create_request_body: { # Override these values es_snapshot_host: "localhost" snapshot_base_path: "default" -backup_container: "elasticsearch-snapshots" \ No newline at end of file +backup_container: "elasticsearch-snapshots" + +### Re-use exisiting variables of azure storage account +azure_management_storage_account_name: "{{ sunbird_management_storage_account_name }}" +azure_management_storage_account_key: "{{ sunbird_management_storage_account_key }}" +azure_management_resource_group: "{{ azure_management_resource_group }}" \ No newline at end of file diff --git a/ansible/roles/es-azure-snapshot/tasks/main.yml b/ansible/roles/es-azure-snapshot/tasks/main.yml index 8ed3950406..fb5d9ebb3e 100644 --- a/ansible/roles/es-azure-snapshot/tasks/main.yml +++ b/ansible/roles/es-azure-snapshot/tasks/main.yml @@ -4,6 +4,16 @@ - set_fact: snapshot_number="snapshot_{{ lookup('pipe','date +%s') }}" +- name: Ensure blob container exisits + azure_rm_storageblob: + resource_group: "{{ azure_management_resource_group }}" + storage_account_name: "{{ azure_management_storage_account_name }}" + container: "{{ backup_container }}" + state: present + environment: + AZURE_STORAGE_KEY: "{{ azure_management_storage_account_key }}" + delegate_to: localhost + - name: Create azure snapshot uri: url: "http://{{ es_snapshot_host }}:9200/_snapshot/{{ snapshot_base_path }}" @@ -16,8 +26,6 @@ uri: url: "http://{{ es_snapshot_host }}:9200/_snapshot/{{ snapshot_base_path }}/{{ snapshot_number }}" method: PUT - body: > - {"indices":"*","include_global_state":false} headers: Content-Type: "application/json"