Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-sb-devops
Commits
cc8bb33c
Commit
cc8bb33c
authored
2 years ago
by
Keshav Prasad
Browse files
Options
Download
Patches
Plain Diff
feat: adding gcp es snapshot module
parent
2e0bfa03
master
login-changes
loginRegisterBtn
prasath-release-5.1.0
release-5.1.0
release-5.1.0-api
release-5.1.0-apiuat
release-5.1.0-bulk-enrol-unenrol
release-5.1.0-uat
release-5.1.0-uatLatest
release-5.1.0-uatapi
release-5.1.0-upsmf-prod
release-uat-nginx
revert-5-login-changes
upstream/release-5.1.0-vdn
release-5.1.0_RC3
release-5.1.0_RC2
release-5.1.0_RC1
release-5.0.2
release-5.0.2_RC1
release-5.0.1
release-5.0.1_RC1
release-5.0.0
release-5.0.0_RC5
release-5.0.0_RC4
release-5.0.0_RC3
release-5.0.0_RC2
No related merge requests found
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
ansible/es.yml
+5
-5
ansible/es.yml
ansible/roles/es-azure-snapshot/tasks/main.yml
+1
-1
ansible/roles/es-azure-snapshot/tasks/main.yml
ansible/roles/es-gcs-snapshot/defaults/main.yml
+12
-0
ansible/roles/es-gcs-snapshot/defaults/main.yml
ansible/roles/es-gcs-snapshot/tasks/main.yml
+1
-14
ansible/roles/es-gcs-snapshot/tasks/main.yml
ansible/roles/es-s3-snapshot/defaults/main.yml
+0
-1
ansible/roles/es-s3-snapshot/defaults/main.yml
ansible/roles/es-s3-snapshot/tasks/main.yml
+42
-0
ansible/roles/es-s3-snapshot/tasks/main.yml
ansible/roles/es6/tasks/main.yml
+3
-3
ansible/roles/es6/tasks/main.yml
ansible/roles/es6/tasks/plugins/repository-gcs.yml
+16
-3
ansible/roles/es6/tasks/plugins/repository-gcs.yml
private_repo/ansible/inventory/dev/Core/common.yml
+5
-0
private_repo/ansible/inventory/dev/Core/common.yml
private_repo/ansible/inventory/dev/Core/secrets.yml
+6
-0
private_repo/ansible/inventory/dev/Core/secrets.yml
with
91 additions
and
27 deletions
+91
-27
ansible/es.yml
+
5
−
5
View file @
cc8bb33c
...
...
@@ -7,11 +7,11 @@
-
snapshot_base_path
:
"
{{app_snapshot_base_path}}"
roles
:
-
role
:
es-azure-snapshot
when
:
cloud_provider == "azure"
-
role
:
es-
aw
s-snapshot
when
:
cloud_provider == "aws"
#
- role: es-gc
loud
-snapshot
#
when: cloud_provider == "gcloud"
when
:
cloud_
service_
provider == "azure"
-
role
:
es-s
3
-snapshot
when
:
cloud_
service_
provider == "aws"
-
role
:
es-gc
s
-snapshot
when
:
cloud_
service_
provider == "gcloud"
-
role
:
es5-snapshot-purge
tags
:
-
es_backup
...
...
This diff is collapsed.
Click to expand it.
ansible/roles/es-azure-snapshot/tasks/main.yml
+
1
−
1
View file @
cc8bb33c
...
...
@@ -17,7 +17,7 @@
AZURE_SECRET
:
"
{{
azure_management_client_secret
}}"
delegate_to
:
localhost
-
name
:
Create
a
zure
snapshot
-
name
:
Create
A
zure
Repository
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}"
method
:
PUT
...
...
This diff is collapsed.
Click to expand it.
ansible/roles/es-gcs-snapshot/defaults/main.yml
0 → 100644
+
12
−
0
View file @
cc8bb33c
snapshot_create_request_body
:
{
type
:
gcs
,
settings
:
{
bucket
:
"
{{
gcs_management_bucket_name
}}"
,
base_path
:
"
{{
es_gcs_backup_folder_name
}}/{{
snapshot_base_path
}}_{{
base_path_date
}}"
}
}
# Override these values
es_snapshot_host
:
"
localhost"
snapshot_base_path
:
"
default"
es_gcs_backup_folder_name
:
"
elasticsearch-snapshots"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ansible/roles/es-
aw
s-snapshot/tasks/main.yml
→
ansible/roles/es-
gc
s-snapshot/tasks/main.yml
+
1
−
14
View file @
cc8bb33c
...
...
@@ -4,20 +4,7 @@
-
set_fact
:
snapshot_number="snapshot_{{ lookup('pipe','date +%s') }}"
# - name: Ensure backup folder exists in aws bucket
# azure_rm_storageblob:
# resource_group: "{{ azure_management_resource_group_name }}"
# storage_account_name: "{{ azure_management_storage_account_name }}"
# container: "{{ es_azure_backup_container_name }}"
# state: present
# environment:
# AZURE_TENANT: "{{ azure_management_tenant_id }}"
# AZURE_SUBSCRIPTION_ID: "{{ azure_management_subscription_id }}"
# AZURE_CLIENT_ID: "{{ azure_management_client_id }}"
# AZURE_SECRET: "{{ azure_management_client_secret }}"
# delegate_to: localhost
-
name
:
Create aws snapshot
-
name
:
Create GCS Repository
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}"
method
:
PUT
...
...
This diff is collapsed.
Click to expand it.
ansible/roles/es-
aw
s-snapshot/defaults/main.yml
→
ansible/roles/es-s
3
-snapshot/defaults/main.yml
+
0
−
1
View file @
cc8bb33c
...
...
@@ -9,5 +9,4 @@ snapshot_create_request_body: {
# Override these values
es_snapshot_host
:
"
localhost"
snapshot_base_path
:
"
default"
es_s3_backup_folder_name
:
"
elasticsearch-snapshots"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ansible/roles/es-s3-snapshot/tasks/main.yml
0 → 100644
+
42
−
0
View file @
cc8bb33c
---
-
set_fact
:
base_path_date="{{ lookup('pipe','date +%Y-%m') }}"
-
set_fact
:
snapshot_number="snapshot_{{ lookup('pipe','date +%s') }}"
-
name
:
Create S3 Repository
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}"
method
:
PUT
body
:
"
{{
snapshot_create_request_body
|
to_json
}}"
headers
:
Content-Type
:
"
application/json"
-
name
:
Take new snapshot
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}/{{
snapshot_number
}}"
method
:
PUT
headers
:
Content-Type
:
"
application/json"
-
name
:
Print all snapshots
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}/_all"
method
:
GET
-
name
:
Print status of current snapshot
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}/{{
snapshot_number
}}"
method
:
GET
-
name
:
"
Wait
for
backup
to
be
completed"
uri
:
url
:
"
http://{{
es_snapshot_host
}}:9200/_snapshot/{{
snapshot_base_path
}}/{{
snapshot_number
}}"
method
:
GET
return_content
:
yes
status_code
:
200
body_format
:
json
register
:
result
until
:
result.json.snapshots[0].state == 'SUCCESS'
retries
:
120
delay
:
10
This diff is collapsed.
Click to expand it.
ansible/roles/es6/tasks/main.yml
+
3
−
3
View file @
cc8bb33c
...
...
@@ -42,15 +42,15 @@
-
name
:
include plugins/repository-azure.yml
include
:
plugins/repository-azure.yml
when
:
cloud_provider == "azure"
when
:
cloud_
service_
provider == "azure"
-
name
:
include plugins/repository-s3.yml
include
:
plugins/repository-s3.yml
when
:
cloud_provider == "aws"
when
:
cloud_
service_
provider == "aws"
-
name
:
include plugins/repository-gcs.yml
include
:
plugins/repository-gcs.yml
when
:
cloud_provider == "gcloud"
when
:
cloud_
service_
provider == "gcloud"
-
name
:
flush handlers
meta
:
flush_handlers
...
...
This diff is collapsed.
Click to expand it.
ansible/roles/es6/tasks/plugins/repository-gcs.yml
+
16
−
3
View file @
cc8bb33c
---
-
name
:
Add gcs credentials file to keystor
e
-
name
:
Create the gcs service account file from variabl
e
become
:
yes
shell
:
echo "{{ gcs_management_bucket_service_account }}" | {{ es_home }}/bin/elasticsearch-keystore add-file -f gcs.client.default.credentials_file google_cloud_store_management_service_account.json
no_log
:
True
\ No newline at end of file
copy
:
dest
:
"
{{
conf_dir
}}/gcs_management_bucket_service_account.json"
content
:
"
{{
gcs_management_bucket_service_account
}}"
-
name
:
Add gcs service account file to keystore
become
:
yes
shell
:
"
{{
es_home
}}/bin/elasticsearch-keystore
add-file
-f
gcs.client.default.credentials_file
{{
conf_dir
}}/gcs_management_bucket_service_account.json"
no_log
:
True
environment
:
ES_PATH_CONF
:
"
{{
conf_dir
}}"
-
name
:
Remove the service account file
file
:
path
:
"
{{
conf_dir
}}/gcs_management_bucket_service_account.json"
state
:
absent
\ No newline at end of file
This diff is collapsed.
Click to expand it.
private_repo/ansible/inventory/dev/Core/common.yml
+
5
−
0
View file @
cc8bb33c
...
...
@@ -38,6 +38,11 @@ azure_management_storage_account_name: ""
# Management Storage Bucket
aws_management_bucket_name
:
"
"
# Define the below if you are using Google Cloud
# Ansible GCP Module Variables
# Management Storage Bucket
gcs_management_bucket_name
:
"
"
# ------------------------------------------------------------------------------------------------------------ #
# Cloud / Infra Specific values - Check these and update accordingly
...
...
This diff is collapsed.
Click to expand it.
private_repo/ansible/inventory/dev/Core/secrets.yml
+
6
−
0
View file @
cc8bb33c
...
...
@@ -30,6 +30,12 @@ aws_management_bucket_user_access_key: ""
aws_management_bucket_user_secret_key
:
"
"
# Define the below if you are using Google Cloud
# Ansible GCP Module Variables
# Management Storage Bucket
gcs_management_bucket_service_account
:
|
#
The proxy key and crt values should be padded to the right by a couple of spaces
#
Example:
#
core_vault_proxy_site_key: |+
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets