aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/roles/common/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/roles/common/tasks')
-rw-r--r--src/roles/common/tasks/main.yml17
-rw-r--r--src/roles/common/tasks/tool.yml8
2 files changed, 25 insertions, 0 deletions
diff --git a/src/roles/common/tasks/main.yml b/src/roles/common/tasks/main.yml
new file mode 100644
index 0000000..fb0eaed
--- /dev/null
+++ b/src/roles/common/tasks/main.yml
@@ -0,0 +1,17 @@
+- name: Check available tools
+ ansible.builtin.include_tasks: tool.yml
+ loop:
+ - apt
+ - docker
+ - flatpak
+ - pacman
+ - rate-mirrors
+ - snap
+ - vagrant
+ - yay
+
+- name: Check if /etc is versioned
+ become: true
+ ansible.builtin.stat:
+ path: /etc/.git/config
+ register: etc_versioned
diff --git a/src/roles/common/tasks/tool.yml b/src/roles/common/tasks/tool.yml
new file mode 100644
index 0000000..48d0acc
--- /dev/null
+++ b/src/roles/common/tasks/tool.yml
@@ -0,0 +1,8 @@
+- name: "Check for {{ item }}"
+ ansible.builtin.command: "{{ item }} --version"
+ register: cmd_result
+ changed_when: false
+ failed_when: false
+
+- name: "Set fact about {{ item }}"
+ ansible.builtin.set_fact: "has_{{ item | replace('-', '_') }}={{ cmd_result.rc == 0 }}"