diff --git a/.config/dotfiles/playbook.yml b/.config/dotfiles/playbook.yml index 7d18f0c..6664038 100644 --- a/.config/dotfiles/playbook.yml +++ b/.config/dotfiles/playbook.yml @@ -27,16 +27,14 @@ vars: dev_mode: false force: false - # Desktop detection: macOS is always desktop, Linux checks systemd target - # Override with --extra-vars "is_desktop=true" or "is_desktop=false" - _linux_desktop: "{{ ansible_service_mgr == 'systemd' and (ansible_facts['default_target'] | default('multi-user.target')) == 'graphical.target' }}" - is_desktop: "{{ is_desktop | default(true if ansible_os_family == 'Darwin' else _linux_desktop) }}" # Standard paths for tools (to avoid PATH dependency during bootstrap) brew_bin: /opt/homebrew/bin/brew local_bin: "{{ ansible_env.HOME }}/.local/bin" cargo_bin: "{{ ansible_env.HOME }}/.cargo/bin" pre_tasks: + # Desktop detection: macOS is always desktop, Linux checks systemd target + # Override with --extra-vars "is_desktop=true" or "is_desktop=false" - name: Gather systemd default target (Linux only) command: systemctl get-default register: systemd_target @@ -44,9 +42,15 @@ failed_when: false when: ansible_system == "Linux" and ansible_service_mgr == "systemd" - - name: Set desktop fact from systemd target + - name: Set desktop fact (macOS is always desktop) + set_fact: + is_desktop: true + when: is_desktop is not defined and ansible_os_family == "Darwin" + + - name: Set desktop fact (Linux checks systemd target) set_fact: - is_desktop: "{{ is_desktop | default(true if ansible_os_family == 'Darwin' else (systemd_target.stdout | default('multi-user.target')) == 'graphical.target') }}" + is_desktop: "{{ (systemd_target.stdout | default('multi-user.target')) == 'graphical.target' }}" + when: is_desktop is not defined and ansible_os_family != "Darwin" - name: Display system type debug: diff --git a/bin/bootstrap b/bin/bootstrap index 0b9f2a1..6552b81 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -46,12 +46,14 @@ echo "Running bootstrap setup..." echo "========================================" echo "" -# Parse arguments to determine if dev mode is requested +# Parse arguments - filter out our custom flags before passing to ansible EXTRA_VARS="" +ANSIBLE_ARGS=() for arg in "$@"; do if [[ "$arg" == "--dev" ]]; then EXTRA_VARS="--extra-vars dev_mode=true" - break + else + ANSIBLE_ARGS+=("$arg") fi done @@ -63,7 +65,7 @@ uvx --from ansible-core ansible-playbook \ --tags setup \ --ask-become-pass \ $EXTRA_VARS \ - "$@" + "${ANSIBLE_ARGS[@]}" echo "" echo "========================================"