lnav install with ansible
lnav is a Linux log file viewer. I use it for viewing local log files as an alternative to tail
and grep
.
lnav can be installed using apt from a debian package, but the version available with Ubuntu 18.04 installed on a old machine is out-of-date. A static binary, which includes all of the dependencies, is available to download from GitLab. I wrote a short ansible task to download the ZIP file from GitHub, extract the lnav binary, and place it in /usr/local/bin
:
---
- name: Check if lnav bin exists
stat:
path: /usr/local/bin/lnav
register: lnav_bin_result
- name: Download and install lnav
when:
- not lnav_bin_result.stat.exists
block:
- get_url:
url: https://github.com/tstack/lnav/releases/download/v0.10.0/lnav-0.10.0-musl-64bit.zip
dest: /tmp/lnav.zip
checksum: sha512:4d730884e8a669c2d3b087201f506b833877bcf6dfc8d8ab925c879f8d4b4a8c46b89488c7ad393662ba5f5c7d002fd816fe4c9e85ad00970f9c5a1fe01b4a13
- unarchive:
remote_src: yes
exclude:
- lnav-0.10.0/NEWS
- lnav-0.10.0/README
src: /tmp/lnav.zip
dest: /tmp/
creates: /tmp/lnav-0.10.0/lnav
- copy:
remote_src: yes
src: /tmp/lnav-0.10.0/lnav
dest: /usr/local/bin/lnav
mode: 0755