diff --git a/elk_metrics_6x/bootstrap-embedded-ansible.sh b/elk_metrics_6x/bootstrap-embedded-ansible.sh index 3a5882b9..d4251b2e 100755 --- a/elk_metrics_6x/bootstrap-embedded-ansible.sh +++ b/elk_metrics_6x/bootstrap-embedded-ansible.sh @@ -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 diff --git a/elk_metrics_6x/installElastic.yml b/elk_metrics_6x/installElastic.yml index 84032bbe..02eac46c 100644 --- a/elk_metrics_6x/installElastic.yml +++ b/elk_metrics_6x/installElastic.yml @@ -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: diff --git a/elk_metrics_6x/templates/elasticsearch.yml.j2 b/elk_metrics_6x/templates/elasticsearch.yml.j2 index 29e918df..d49ffb6f 100644 --- a/elk_metrics_6x/templates/elasticsearch.yml.j2 +++ b/elk_metrics_6x/templates/elasticsearch.yml.j2 @@ -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: diff --git a/elk_metrics_6x/vars/variables.yml b/elk_metrics_6x/vars/variables.yml index a37cd1c2..78e9afc0 100644 --- a/elk_metrics_6x/vars/variables.yml +++ b/elk_metrics_6x/vars/variables.yml @@ -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: ":/esbackup" +# opts: clientaddr="{{ ansible_eth1['ipv4']['address'] }}" +# path: "/elastic-backup" +# state: mounted + # kibana vars kibana_interface: 0.0.0.0 kibana_port: 5601