From b02a8c40c76cb2e61c7a664ec156407101201a24 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 25 Jan 2023 14:40:44 +0100 Subject: move tool existence conditionals to role common --- roles/common/tasks/main.yml | 16 ++++++++++++++++ roles/common/tasks/tool.yml | 8 ++++++++ 2 files changed, 24 insertions(+) create mode 100644 roles/common/tasks/main.yml create mode 100644 roles/common/tasks/tool.yml (limited to 'roles/common') diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 0000000..558f268 --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1,16 @@ +- include_tasks: tool.yml + loop: + - apt + - docker + - flatpak + - pacman + - rate-mirrors + - snap + - vagrant + - yay + +- name: Check if /etc is versioned + become: true + stat: + path: /etc/.git/config + register: etc_versioned diff --git a/roles/common/tasks/tool.yml b/roles/common/tasks/tool.yml new file mode 100644 index 0000000..f8fda64 --- /dev/null +++ b/roles/common/tasks/tool.yml @@ -0,0 +1,8 @@ +- name: "Check for {{ item }}" + command: "{{ item }} --version" + register: cmd_result + changed_when: false + failed_when: false + +- name: "Set fact about {{ item }}" + set_fact: "has_{{ item | replace('-', '_') }}={{ cmd_result.rc == 0 }}" -- cgit v1.2.3