2022-11-19 18:05:14 +00:00
|
|
|
- name: GITHUB | Get current version of bat
|
2022-12-10 17:51:03 +00:00
|
|
|
ansible.builtin.shell: >
|
2022-11-19 18:05:14 +00:00
|
|
|
set -o pipefail &&
|
|
|
|
curl -L --silent https://api.github.com/repos/sharkdp/bat/releases/latest |
|
|
|
|
grep '"tag_name":' |
|
|
|
|
sed -E 's/.*"([^"]+)".*/\1/'|sed 's/v//'
|
|
|
|
register: bat_version
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
changed_when: false
|
|
|
|
failed_when: >
|
|
|
|
bat_version.rc != 0 or
|
|
|
|
not bat_version.stdout|regex_search('\w+\.\w+\.\w+')
|
|
|
|
- name: DEBIAN | Set URL to download bins
|
2022-12-10 17:51:03 +00:00
|
|
|
ansible.builtin.set_fact:
|
2022-11-19 18:05:14 +00:00
|
|
|
debian_url: "https://github.com/sharkdp/bat/releases/download/v{{ bat_version.stdout }}/bat_{{ bat_version.stdout }}_amd64.deb"
|
|
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
|
|
|
|
|
|
- name: DEBIAN | Install deb from github
|
|
|
|
become: true
|
2022-12-10 17:51:03 +00:00
|
|
|
ansible.builtin.apt:
|
2022-11-19 18:05:14 +00:00
|
|
|
deb: "{{ debian_url }}"
|
|
|
|
when: ansible_facts['os_family'] == "Debian"
|