Skip to content

Commit

Permalink
fix: interim commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beepdot committed Aug 29, 2022
1 parent 8554e32 commit 6794498
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
8 changes: 4 additions & 4 deletions ansible/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion ansible/roles/es-azure-snapshot/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ snapshot_create_request_body: {
# Override these values
es_snapshot_host: "localhost"
snapshot_base_path: "default"
backup_container: "elasticsearch-snapshots"
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 }}"
12 changes: 10 additions & 2 deletions ansible/roles/es-azure-snapshot/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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"

Expand Down

0 comments on commit 6794498

Please sign in to comment.