From dcac7dae3973935183d600f6086b2570b91d86de Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 19 Nov 2022 19:05:14 +0100 Subject: [PATCH] correct bat issue and dedicated file --- tasks/base_software.yml | 27 --------------------------- tasks/bat.yml | 25 +++++++++++++++++++++++++ tasks/main.yml | 2 ++ 3 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 tasks/bat.yml diff --git a/tasks/base_software.yml b/tasks/base_software.yml index 73225c1..d8f7a6d 100644 --- a/tasks/base_software.yml +++ b/tasks/base_software.yml @@ -54,33 +54,6 @@ become: true when: ansible_facts['os_family'] == "RedHat" - -- name: GITHUB | Get current version of bat - shell: > - warn=False - 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 - changed_when: false - failed_when: > - bat_version.rc != 0 or - not bat_version.stdout|regex_search('\w+\.\w+\.\w+') - when: ansible_facts['os_family'] == "Debian" - -- name: DEBIAN | Set URL to download bins - set_fact: - 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 - apt: - deb: "{{ debian_url }}" - when: ansible_facts['os_family'] == "Debian" - #- name: pass user shell to zsh # user: # name: "{{ user.name }}" diff --git a/tasks/bat.yml b/tasks/bat.yml new file mode 100644 index 0000000..0eedf19 --- /dev/null +++ b/tasks/bat.yml @@ -0,0 +1,25 @@ +- name: GITHUB | Get current version of bat + shell: > + 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 + set_fact: + 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 + apt: + deb: "{{ debian_url }}" + when: ansible_facts['os_family'] == "Debian" + + diff --git a/tasks/main.yml b/tasks/main.yml index f6e6a0b..c30d434 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,3 +27,5 @@ - include_tasks: AUR_builder.yml when: ansible_facts['os_family'] == "Archlinux" - include_tasks: base_software.yml +- include_tasks: bat.yml + when: ansible_facts['os_family'] == "Debian"