Allow mounting of shared filesystems for index backup/restore

Change-Id: I6590bd0b7560fe42bd82d1a8aa7932a45f067ca5
This commit is contained in:
Jonathan Rosser 2018-07-25 15:27:08 +00:00 committed by Jonathan Rosser
parent c495a6f3df
commit 39e9905d00
4 changed files with 41 additions and 0 deletions

View File

@ -36,6 +36,7 @@ if [[ ! -e "${ANSIBLE_EMBED_HOME}/bin/ansible" ]]; then
fi
eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade --force pip"
eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade ansible==2.5.5.0 --isolated"
eval "${ANSIBLE_EMBED_HOME}/bin/pip install --upgrade jmespath --isolated"
echo "Ansible can be found here: ${ANSIBLE_EMBED_HOME}/bin"
fi

View File

@ -8,6 +8,7 @@
vars:
temp_dir: /var/lib/elasticsearch/tmp
nfs_query: "[?fstype=='nfs' || fstype=='nfs4']"
environment: "{{ deployment_environment_variables | default({}) }}"
@ -172,6 +173,26 @@
src: "templates/logrotate.j2"
dest: "/etc/logrotate.d/elasticsearch"
- name: Ensure nfs client is available if necessary
package:
name: nfs-common
state: present
when:
- elastic_shared_fs_repos is defined
- (elastic_shared_fs_repos|json_query(nfs_query)) | length > 0
- name: Ensure backup filesystems are mounted
mount:
fstype: "{{ item.fstype }}"
src: "{{ item.src }}"
opts: "{{ item.opts }}"
path: "{{ item.path }}"
state: "{{ item.state }}"
with_items:
- "{{ elastic_shared_fs_repos }}"
when:
- elastic_shared_fs_repos is defined and elastic_shared_fs_repos | length > 0
handlers:
- name: Enable and restart elastic
systemd:

View File

@ -17,6 +17,15 @@ path.data: /var/lib/elasticsearch
# path.logs: /path/to/logs
#path.logs: /var/lib/elasticsearch/logs/
path.logs: /var/log/elasticsearch/
#
# Path to shared filesystem repos
#
# path.repo: ["/mount/backups", "/mount/longterm_backups"]
#
{% if elastic_shared_fs_repos is defined and elastic_shared_fs_repos|length > 0 %}
path.repo: {{ elastic_shared_fs_repos | json_query("[*].path") | to_json }}
{% endif %}
# Set the global default index store. More information on these settings can be
# found here:

View File

@ -58,6 +58,16 @@ elastic_vip_url: >-
http://{{ hostvars[groups['kibana'][0]]['ansible_host'] ~ ':' ~ elastic_port }}
{% endif %}
#define this in host/group vars as needed to mount remote filesystems
#set the client address as appropriate, eth1 assumes osa container mgmt network
#mountpoints and server paths are just examples
#elastic_shared_fs_repos:
# - fstype: nfs4
# src: "<nfs-server-ip>:/esbackup"
# opts: clientaddr="{{ ansible_eth1['ipv4']['address'] }}"
# path: "/elastic-backup"
# state: mounted
# kibana vars
kibana_interface: 0.0.0.0
kibana_port: 5601