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 <kevin@cloudnull.com>
This commit is contained in:
Kevin Carter 2019-01-25 13:53:41 -06:00
parent cfa103dab7
commit 82cc72e166
1 changed files with 7 additions and 2 deletions

View File

@ -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