From 82cc72e16658fa9b6925b2529fa4d26d84e62764 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Fri, 25 Jan 2019 13:53:41 -0600 Subject: [PATCH] Read the path for the logstash queue path The queue path within logstash may be a symlink which will fail to mount as tempfs. To ensure queue path can be tempfs, a readlink command is used to fetch the true path, which will be used in a mount when nessisary. Change-Id: I5fe6bf311e0621c98766ae458371b5f11f89a61f Signed-off-by: Kevin Carter --- elk_metrics_6x/roles/elastic_logstash/tasks/main.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml b/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml index 773a2a96..98ade79a 100644 --- a/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml +++ b/elk_metrics_6x/roles/elastic_logstash/tasks/main.yml @@ -122,13 +122,18 @@ when: - ansible_service_mgr == 'systemd' + - name: Read logstash queue path + command: "readlink -f /var/lib/logstash/queue" + register: logstash_queue_path + changed_when: false + - name: Run the systemd mount role include_role: name: systemd_mount vars: systemd_mounts: - what: "tmpfs" - where: "/var/lib/logstash/queue" + where: "{{ logstash_queue_path.stdout.strip() }}" type: "tmpfs" options: "size={{ (q_mem | int) // 2 }}m,uid={{ logstash_uid.stdout }},gid={{ logstash_gid.stdout }},nodev,nodiratime,noatime" unit: @@ -141,7 +146,7 @@ - name: Apply fstab options for memory queues mount: - path: /var/lib/logstash/queue + path: "{{ logstash_queue_path.stdout.strip() }}" src: tmpfs fstype: tmpfs opts: size={{ (q_mem | int) // 2 }}m