Skip to content
Snippets Groups Projects
Commit 6aa95b1e authored by jurgenhaas's avatar jurgenhaas
Browse files

Improve scripts and credentials

Provide a generic script to run ES commands
parent 2ef41c0d
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
if [[ "$2" == "" ]]; then
echo "Usage: elasticsearch METHOD URLPATH [ARGUMENTS]"
exit 1
fi
source /root/.elasticsearch
METHOD=$1
URLPATH=$2
shift
shift
curl -X $METHOD http://${ESUSER}:${ESPASS}@localhost:9200/$URLPATH "$@"
......@@ -32,6 +32,16 @@
notify:
- Restart Elasticsearch
- name: Credential script
template:
src: credentials
dest: /root/.elasticsearch
owner: root
group: root
mode: 0750
tags:
- Config
- include_tasks: re-install-plugins.yml
tags:
- reinstall-plugins
......@@ -91,3 +101,9 @@
delay: 10
timeout: 120
state: present
- name: Copy script
copy:
src: elasticsearch
dest: /usr/local/bin/elasticsearch
mode: 0755
#!/bin/bash
ESUSER=elastic
ESPASS={{ elasticsearch.users.elastic|default('') }}
export $ESUSER
export $ESPASS
#!/bin/bash
curl -X PUT http://elastic:{{ elasticsearch.users.elastic|default('') }}@localhost:9200/_all/_settings -H 'Content-Type: application/json' -d'{ "index.blocks.read_only_allow_delete" : false } }'
source /root/.elasticsearch
curl -X PUT http://${ESUSER}:${ESPASS}@localhost:9200/_all/_settings -H 'Content-Type: application/json' -d'{ "index.blocks.read_only_allow_delete" : false } }'
......@@ -2,4 +2,6 @@
{% set ES_INDICES = elasticsearch.snapshot.indices|join(',') %}
curl -X PUT 'http://elastic:{{ elasticsearch.users.elastic|default("") }}@localhost:9200/_snapshot/Backup/%3Csnapshot-%7Bnow%2Fd%7D%3E?wait_for_completion=true' -H 'Content-Type: application/json' -d '{"indices": "{{ ES_INDICES }}","ignore_unavailable": true,"include_global_state": false}'
source /root/.elasticsearch
curl -X PUT 'http://${ESUSER}:${ESPASS}@localhost:9200/_snapshot/Backup/%3Csnapshot-%7Bnow%2Fd%7D%3E?wait_for_completion=true' -H 'Content-Type: application/json' -d '{"indices": "{{ ES_INDICES }}","ignore_unavailable": true,"include_global_state": false}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment