diff --git a/bin/helpers/functions.py b/bin/helpers/functions.py index 198463e..f6a0af3 100644 --- a/bin/helpers/functions.py +++ b/bin/helpers/functions.py @@ -5,6 +5,7 @@ import sys import subprocess import math import random +import shutil try: import pyfiglet except ImportError: @@ -79,15 +80,20 @@ def logo(continue_after=False): sys.exit(0) except Exception as e: printfe("red", f"Error displaying logo: {e}") - def run_command(command, shell=False): """Run a shell command and return the result""" try: + if not shell and not shutil.which(command[0]): + return False, f"Command '{command[0]}' not found" + result = subprocess.run(command, shell=shell, check=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return True, result.stdout.strip() except subprocess.CalledProcessError as e: return False, e.stderr.strip() + except FileNotFoundError: + return False, f"Command '{command[0]}' not found" + return False, e.stderr.strip() def ensure_dependencies(): """Check and install required dependencies for the dotfiles system""" diff --git a/config/ansible/tasks/servers/server.yml b/config/ansible/tasks/servers/server.yml index 83be04c..533c9c5 100644 --- a/config/ansible/tasks/servers/server.yml +++ b/config/ansible/tasks/servers/server.yml @@ -4,3 +4,12 @@ - openssh-server state: present become: true + +- name: Ensure checkout docker /mnt/services repository + ansible.builtin.git: + repo: "https://git.mvl.sh/vleeuwenmenno/services.git" + dest: "/mnt/services" + update: true + version: "main" + register: git_result + changed_when: git_result.changed