43 lines
1014 B
YAML
43 lines
1014 B
YAML
---
|
|
- name: Set architecture specific variables
|
|
set_fact:
|
|
arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
|
|
|
|
- name: Create temp directory
|
|
file:
|
|
path: /tmp/temp
|
|
state: directory
|
|
|
|
- name: Fetch latest lf version
|
|
uri:
|
|
url: "https://api.github.com/repos/gokcehan/lf/releases/latest"
|
|
return_content: yes
|
|
register: lf_release
|
|
|
|
- name: Extract lf version from response
|
|
set_fact:
|
|
lf_version: "{{ lf_release.content | from_json | json_query('tag_name') | regex_replace('^v', '') }}"
|
|
|
|
- name: Download lf tar.gz
|
|
get_url:
|
|
url: "https://github.com/gokcehan/lf/releases/download/{{ lf_version }}/lf-linux-{{ arch }}.tar.gz"
|
|
dest: /tmp/temp/lf.tar.gz
|
|
|
|
- name: Extract lf
|
|
unarchive:
|
|
src: /tmp/temp/lf.tar.gz
|
|
dest: /tmp/temp/
|
|
remote_src: yes
|
|
|
|
- name: Copy lf to /usr/local/bin
|
|
copy:
|
|
src: /tmp/temp/lf
|
|
dest: /usr/local/bin/lf
|
|
mode: '0755'
|
|
remote_src: yes
|
|
|
|
- name: Remove temp directory
|
|
file:
|
|
path: /tmp/temp
|
|
state: absent
|