This repository was archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cortex: add ElasticSearch index creation
Signed-off-by: Jakub Sokołowski <[email protected]>
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Create the ElasticSearch index | ||
uri: | ||
url: 'http://{{ cortex_search_nodes[0].addr }}:{{ cortex_search_nodes[0].port }}/{{ cortex_index_name }}' | ||
method: 'PUT' | ||
return_content: true | ||
status_code: [ 201, 400 ] | ||
register: es_resp | ||
|
||
- name: Verify that index was creates | ||
assert: | ||
that: '{{ es_resp.json["acknowledged"] == true }}' | ||
fail_msg: 'Failed to create ElasticSearch index: {{ cortex_index_name }}' | ||
when: es_resp.status == 201 | ||
|
||
- name: Verify that index already exists | ||
assert: | ||
that: '{{ es_resp.json["error"]["type"] == "resource_already_exists_exception" }}' | ||
fail_msg: 'Failed to create ElasticSearch index: {{ cortex_index_name }}' | ||
when: es_resp.status == 400 |
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