forked from hitachienergy/epiphany
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All in one commit - from PR hitachienergy#2983
- Loading branch information
Showing
116 changed files
with
2,346 additions
and
1,578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# Ansible playbook for installing OpenSearch | ||
|
||
- hosts: opensearch | ||
become: true | ||
become_method: sudo | ||
roles: | ||
- opensearch | ||
vars: | ||
current_group_name: "opensearch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# Ansible playbook for installing OpenSearch Dashboards | ||
- hosts: repository # to gather facts | ||
tasks: [] | ||
|
||
- hosts: opensearch_dashboards | ||
become: true | ||
become_method: sudo | ||
roles: | ||
- opensearch_dashboards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 0 additions & 90 deletions
90
ansible/playbooks/roles/backup/tasks/logging_elasticsearch_snapshot.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
ansible/playbooks/roles/backup/tasks/logging_opensearch_snapshot.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
- name: Include default vars from opensearch role | ||
include_vars: | ||
file: roles/opensearch/defaults/main.yml | ||
name: opensearch_defaults | ||
|
||
- name: Set helper facts | ||
set_fact: | ||
opensearch_endpoint: >- | ||
https://{{ ansible_default_ipv4.address }}:9200 | ||
snapshot_name: >- | ||
{{ ansible_date_time.iso8601_basic_short | replace('T','-') }} | ||
vars: | ||
uri_template: &uri | ||
client_cert: "{{ opensearch_defaults.certificates.dirs.certs }}/{{ opensearch_defaults.certificates.files.admin.cert.filename }}" | ||
client_key: "{{ opensearch_defaults.certificates.dirs.certs }}/{{ opensearch_defaults.certificates.files.admin.key.filename }}" | ||
validate_certs: false | ||
body_format: json | ||
|
||
- name: Check cluster health | ||
uri: | ||
<<: *uri | ||
url: "{{ opensearch_endpoint }}/_cluster/health" | ||
method: GET | ||
return_content: yes | ||
register: cluster_status | ||
until: cluster_status.json.status | ||
retries: 60 | ||
delay: 1 | ||
|
||
- name: No backup warning | ||
when: not cluster_status.json.number_of_nodes == 1 | ||
debug: | ||
msg: "[WARNING] No snapshot backup created as only single-node cluster backup is supported." | ||
|
||
- name: Snapshot backup | ||
when: cluster_status.json.number_of_nodes == 1 # https://github.com/epiphany-platform/epiphany/blob/develop/docs/home/howto/BACKUP.md#logging | ||
block: | ||
- name: Ensure snapshot repository is defined | ||
uri: | ||
<<: *uri | ||
url: "{{ opensearch_endpoint }}/_snapshot/{{ opensearch_snapshot_repository_name }}" | ||
method: PUT | ||
body: | ||
type: fs | ||
settings: | ||
location: "{{ opensearch_snapshot_repository_location }}" | ||
compress: true | ||
|
||
- name: Trigger snapshot creation | ||
uri: | ||
<<: *uri | ||
url: "{{ opensearch_endpoint }}/_snapshot/{{ opensearch_snapshot_repository_name }}/{{ snapshot_name }}" | ||
method: PUT | ||
|
||
- name: Wait (up to 12h) for snapshot completion | ||
uri: | ||
<<: *uri | ||
url: "{{ opensearch_endpoint }}/_snapshot/{{ opensearch_snapshot_repository_name }}/{{ snapshot_name }}" | ||
method: GET | ||
register: uri_response | ||
until: (uri_response.json.snapshots | selectattr('snapshot', 'equalto', snapshot_name) | first).state == "SUCCESS" | ||
retries: "{{ (12 * 3600 // 10) | int }}" # 12h | ||
delay: 10 | ||
|
||
- name: Find all snapshots | ||
uri: | ||
<<: *uri | ||
url: "{{ opensearch_endpoint }}/_snapshot/{{ opensearch_snapshot_repository_name }}/_all" | ||
method: GET | ||
register: uri_response | ||
|
||
- name: Delete old snapshots | ||
uri: | ||
<<: *uri | ||
url: "{{ opensearch_endpoint }}/_snapshot/{{ opensearch_snapshot_repository_name }}/{{ item }}" | ||
method: DELETE | ||
loop: >- | ||
{{ uri_response.json.snapshots | map(attribute='snapshot') | reject('equalto', snapshot_name) | list }} | ||
- name: Create snapshot archive | ||
import_tasks: common/create_snapshot_archive.yml | ||
vars: | ||
snapshot_prefix: "opensearch_snapshot" | ||
dirs_to_archive: | ||
- "{{ opensearch_snapshot_repository_location }}/" | ||
|
||
- name: Create snapshot checksum | ||
import_tasks: common/create_snapshot_checksum.yml | ||
|
||
- name: Transfer artifacts via rsync | ||
import_tasks: common/download_via_rsync.yml | ||
vars: | ||
artifacts: | ||
- "{{ snapshot_path }}" | ||
- "{{ snapshot_path }}.sha1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
- name: Include installation task | ||
include_tasks: install-es-curator-{{ ansible_os_family }}.yml | ||
include_tasks: install-ops-curator-{{ ansible_os_family }}.yml | ||
|
||
- name: Include configuration tasks | ||
include_tasks: configure-cron-jobs.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.