Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .config/dotfiles/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,30 @@
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
changed_when: false
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:
Expand Down
8 changes: 5 additions & 3 deletions bin/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -63,7 +65,7 @@ uvx --from ansible-core ansible-playbook \
--tags setup \
--ask-become-pass \
$EXTRA_VARS \
"$@"
"${ANSIBLE_ARGS[@]}"

echo ""
echo "========================================"
Expand Down
Loading