From ed8a33e00cfa08f314cd849b3196f0d88f67b2e9 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 22 Oct 2026 08:42:00 -0700 Subject: [PATCH] Modify environment variables for Flutter, Android, and Java. --- tasks/workstation/linux/software/android.yml | 39 +---------- tasks/workstation/linux/software/flutter.yml | 3 +- tasks/workstation/linux/software/java.yml | 68 +++++++++++++------- 3 files changed, 51 insertions(+), 59 deletions(-) diff --git a/tasks/workstation/linux/software/android.yml b/tasks/workstation/linux/software/android.yml index 9743658..7320a41 100644 --- a/tasks/workstation/linux/software/android.yml +++ b/tasks/workstation/linux/software/android.yml @@ -397,47 +397,13 @@ ## Configure Environment ## -- name: Workstation | Linux | Software | Android | Modify PATH (.bashrc) - ansible.builtin.blockinfile: - path: "{{ item }}/.bashrc" - block: | - export PATH="$PATH:{{ android_bin_location }}:{{ android_sdk_cmdline_final }}" - marker: '# {mark} MANAGED BY ANSIBLE | Android' - state: absent - create: true - backup: true - mode: "0755" - loop: - - "{{ user_root.home }}" - - "{{ user_user.home }}" - when: coding - and user_root.home != "" - and user_user.home != "" - -- name: Workstation | Linux | Software | Android | Modify PATH (.zshrc) - ansible.builtin.blockinfile: - path: "{{ item }}/.zshrc" - block: | - export PATH="$PATH:{{ android_bin_location }}:{{ android_sdk_cmdline_final }}" - marker: '# {mark} MANAGED BY ANSIBLE | Android' - state: absent - create: true - backup: true - mode: "0755" - loop: - - "{{ user_root.home }}" - - "{{ user_user.home }}" - when: coding - and user_root.home != "" - and user_user.home != "" - -- name: Workstation | Linux | Software | Flutter | Modify PATH (profiles) +- name: Workstation | Linux | Software | Android | Modify PATH (profiles) ansible.builtin.blockinfile: path: "{{ user_user.home }}/{{ item }}" block: | export ANDROID_HOME="{{ android_sdk_location }}" export ANDROID_SDK_ROOT="$ANDROID_HOME" - export PATH="$PATH:{{ android_bin_location }}:{{ android_sdk_cmdline_final }}" + export PATH="{{ android_bin_location }}:{{ android_sdk_cmdline_final }}:$PATH" marker: '# {mark} MANAGED BY ANSIBLE | Android' state: present create: true @@ -446,6 +412,7 @@ loop: - ".bash_profile" - ".zprofile" + - ".profile" when: coding and user_user.home != "" diff --git a/tasks/workstation/linux/software/flutter.yml b/tasks/workstation/linux/software/flutter.yml index 68c2d4d..7253f07 100644 --- a/tasks/workstation/linux/software/flutter.yml +++ b/tasks/workstation/linux/software/flutter.yml @@ -166,7 +166,7 @@ ansible.builtin.blockinfile: path: "{{ user_user.home }}/{{ item }}" block: | - export PATH="$PATH:{{ flutter_bin_location }}" + export PATH="{{ flutter_bin_location }}:$PATH" marker: '# {mark} MANAGED BY ANSIBLE | Flutter' state: present create: true @@ -175,6 +175,7 @@ loop: - ".bash_profile" - ".zprofile" + - ".profile" when: coding and user_user.home != "" diff --git a/tasks/workstation/linux/software/java.yml b/tasks/workstation/linux/software/java.yml index 3819cce..9ea8766 100644 --- a/tasks/workstation/linux/software/java.yml +++ b/tasks/workstation/linux/software/java.yml @@ -5,31 +5,55 @@ - name: Workstation | Linux | Software | Java | pacman block: - - name: Workstation | Linux | Software | Java | pacman | Facts - ansible.builtin.set_fact: - jdk_version: 21 - jdk_dir: ~/SDKs/Java + - name: Workstation | Linux | Software | Java | pacman | Facts + ansible.builtin.set_fact: + jdk_version: 21 + jdk_src: /usr/lib/jvm/default + jdk_dir: ~/SDKs/Java + jdk_path: ~/SDKs/Java/bin - - name: Workstation | Linux | Software | Java | pacman | Install - ansible.builtin.package: - name: - - "jdk{{ item }}-openjdk" - state: present - loop: - - "{{ jdk_version }}" - - 25 - - 21 - - 17 + - name: Workstation | Linux | Software | Java | pacman | Install + ansible.builtin.package: + name: + - "jdk{{ item }}-openjdk" + state: present + loop: + - "{{ jdk_version }}" + - 25 + - 21 + - 17 - - name: Workstation | Linux | Software | Java | pacman | Set - ansible.builtin.shell: "archlinux-java set java-{{ jdk_version }}-openjdk" + - name: Workstation | Linux | Software | Java | pacman | Set + ansible.builtin.shell: "archlinux-java set java-{{ jdk_version }}-openjdk" + register: shell_check + changed_when: shell_check.rc == 0 - - name: Workstation | Linux | Software | Java | pacman | Link - ansible.builtin.shell: "ln -sf /usr/lib/jvm {{ jdk_dir }}" - args: - creates: "{{ jdk_dir }}" - become: true - become_user: "{{ user }}" + - name: Workstation | Linux | Software | Java | pacman | Link + ansible.builtin.file: + src: "{{ jdk_src }}" + dest: "{{ jdk_dir }}" + state: link + become: true + become_user: "{{ user }}" + + - name: Workstation | Linux | Software | Java | Modify PATH (profiles) + ansible.builtin.blockinfile: + path: "{{ user_user.home }}/{{ item }}" + block: | + export JAVA_HOME="{{ jdk_dir }}" + export JAVA_PATH="{{ jdk_path }}" + export PATH="$JAVA_PATH:$PATH + marker: '# {mark} MANAGED BY ANSIBLE | Java' + state: present + create: true + backup: true + mode: "0755" + loop: + - ".bash_profile" + - ".zprofile" + - ".profile" + when: coding + and user_user.home != "" when: coding is true and ansible_pkg_mgr == "pacman"