diff --git a/tasks/workstation/linux/software/android.yml b/tasks/workstation/linux/software/android.yml index 9743658..6f9f127 100644 --- a/tasks/workstation/linux/software/android.yml +++ b/tasks/workstation/linux/software/android.yml @@ -363,7 +363,7 @@ ## Flutter and Licenses ## - name: Workstation | Linux | Software | Android | Inform Flutter - ansible.builtin.shell: "{{ flutter }} config --android-sdk={{ android_sdk_location }}" + ansible.builtin.shell: "{{ flutter_exe }} config --android-sdk={{ android_sdk_location }}" become: true become_user: "{{ user }}" register: shell_check @@ -379,7 +379,7 @@ when: coding - name: Workstation | Linux | Software | Android | License Agreements [2/2] - ansible.builtin.shell: "yes | {{ flutter }} doctor --android-licenses" + ansible.builtin.shell: "yes | {{ flutter_exe }} doctor --android-licenses" become: true become_user: "{{ user }}" register: shell_check @@ -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_HOME="{{ android_sdk_location | replace('~', '$HOME') }}" 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..37228e3 100644 --- a/tasks/workstation/linux/software/flutter.yml +++ b/tasks/workstation/linux/software/flutter.yml @@ -12,19 +12,20 @@ - name: Workstation | Linux | Software | Flutter | Facts 2 ansible.builtin.set_fact: - flutter_bin_location: "{{ flutter_sdk_location }}/flutter/bin" + flutter_home: "{{ flutter_sdk_location }}/flutter" + flutter_bin: "{{ flutter_sdk_location }}/flutter/bin" - name: Workstation | Linux | Software | Flutter | Facts 3 ansible.builtin.set_fact: - flutter: "{{ flutter_bin_location }}/flutter" + flutter_exe: "{{ flutter_bin }}/flutter" - name: Workstation | Linux | Software | Flutter | Facts 4 ansible.builtin.set_fact: flutter_report_commands: - "date > {{ flutter_report }}" - - "{{ flutter }} --disable-analytics >> {{ flutter_report }}" + - "{{ flutter_exe }} --disable-analytics >> {{ flutter_report }}" - "date >> {{ flutter_report }}" - - "{{ flutter }} doctor -v >> {{ flutter_report }}" + - "{{ flutter_exe }} doctor -v >> {{ flutter_report }}" - "date >> {{ flutter_report }}" ## Checks ## @@ -128,45 +129,12 @@ ## Configure Environment ## -- name: Workstation | Linux | Software | Flutter | Modify PATH (.bashrc) - ansible.builtin.blockinfile: - path: "{{ item }}/.bashrc" - block: | - export PATH="$PATH:{{ flutter_bin_location }}" - marker: '# {mark} MANAGED BY ANSIBLE | Flutter' - 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 (.zshrc) - ansible.builtin.blockinfile: - path: "{{ item }}/.zshrc" - block: | - export PATH="$PATH:{{ flutter_bin_location }}" - marker: '# {mark} MANAGED BY ANSIBLE | Flutter' - 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) ansible.builtin.blockinfile: path: "{{ user_user.home }}/{{ item }}" block: | - export PATH="$PATH:{{ flutter_bin_location }}" + export FLUTTER_HOME="{{ flutter_home }}" + export PATH="{{ flutter_bin }}:$PATH" marker: '# {mark} MANAGED BY ANSIBLE | Flutter' state: present create: true @@ -175,6 +143,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..14887fb 100644 --- a/tasks/workstation/linux/software/java.yml +++ b/tasks/workstation/linux/software/java.yml @@ -2,34 +2,76 @@ # 20260912 - Hyperling # Arch has too new of Java for Android / Gradle to even run AGP Assistant on. +- name: Workstation | Linux | Software | Java | Facts 1 + ansible.builtin.set_fact: + jdk_version: 21 + jdk_src: /usr/lib/jvm/default-java + jdk_dir: "{{ user_user.home}}/SDKs/Java" + +- name: Workstation | Linux | Software | Java | Facts 2 + ansible.builtin.set_fact: + jdk_path: "{{ jdk_dir }}/bin" + +- name: Workstation | Linux | Software | Java | apt + ansible.builtin.package: + name: + - "default-jdk" + state: present + when: ansible_pkg_mgr == "apt" + - 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_src: /usr/lib/jvm/default - - 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 [base] + ansible.builtin.package: + name: + - "jdk{{ jdk_version }}-openjdk" + state: present - - name: Workstation | Linux | Software | Java | pacman | Set - ansible.builtin.shell: "archlinux-java set java-{{ jdk_version }}-openjdk" + - name: Workstation | Linux | Software | Java | pacman | Install [all] + ansible.builtin.package: + name: + - "jdk{{ item }}-openjdk" + state: present + loop: + - 25 + - 21 + - 17 + when: coding - - 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 | Set + ansible.builtin.shell: "archlinux-java set java-{{ jdk_version }}-openjdk" + register: shell_check + changed_when: shell_check.rc == 0 - when: coding is true - and ansible_pkg_mgr == "pacman" + when: ansible_pkg_mgr == "pacman" + +- 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: user_user.home != "" diff --git a/tasks/workstation/linux/software/llm.md b/tasks/workstation/linux/software/llm.md index 4cacc3e..0df4495 100644 --- a/tasks/workstation/linux/software/llm.md +++ b/tasks/workstation/linux/software/llm.md @@ -43,6 +43,17 @@ overwhelming them with technical details unless asked. You know that the designer you are working with (me) likely already understands these things and does not need them included in our conversation. +Android SDK is at $ANDROID_HOME and should be "$HOME/SDKs/Android/Sdk". +Flutter SDK is at $FLUTTER_HOME and should be "$HOME/SDKs/Flutter/flutter". +Java SDK (JDK) is at $JAVA_HOME and should be "$HOME/SDKs/Java". + +These may be useful to add to your PATH: + +- "$ANDROID_HOME/platform-tools" +- "$ANDROID_HOME/cmdline-tools/latest/bin" +- "$FLUTTER_HOME/bin" +- "$JAVA_HOME/bin" + #### Quick Developer Handles code changes with simpler technologies, preferring minimal changes, and diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index bd02572..6a1ba50 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -558,11 +558,12 @@ echo "RUN: Updating..." docker pull $image & - if curl -sf --max-time 5 -o /dev/null https://hyperling.com; then - # Internet is available, pull extra packages. useful for having - # model compile Android apps, need to verify for Flutter. - packages="xz-utils libglu1-mesa libglu1-mesa ninja-build libnotify-bin libgtk-3-dev liblzma-dev libstdc++-12-dev libc6:amd64 libstdc++6 lib32z1 libbz2-1.0 default-jdk libncurses-dev android-udev-rules" - fi + # This takes too long. Mount JDK from the host instead. + #if curl -sf --max-time 5 -o /dev/null https://hyperling.com; then + # # Internet is available, pull extra packages. useful for having + # # model compile Android apps, need to verify for Flutter. + # packages="default-jdk xz-utils libglu1-mesa libglu1-mesa ninja-build libnotify-bin libgtk-3-dev liblzma-dev libstdc++-12-dev libc6:amd64 libstdc++6 lib32z1 libbz2-1.0 libncurses-dev android-udev-rules" + #fi # Start the open-terminal program. # https://github.com/open-webui/open-terminal#configuration @@ -570,10 +571,17 @@ exec docker run \ --name open-terminal \ --network=host \ - -v {{ user_user.home }}/AI-Sandbox:{{ user_user.home }} \ - -v {{ user_user.home }}/Code:{{ user_user.home }}/Code \ - -e OPEN_TERMINAL_FILE_BROWSER_ROOT={{ user_user.home }} \ - -e OPEN_TERMINAL_API_KEY={{ open_terminal_key }} \ + -v {{ user_user.home }}/AI-Sandbox:/home/user \ + -v {{ user_user.home }}/Code:/home/user/Code \ + -v {{ user_user.home }}/SDKs:/home/user/SDKs \ + -v {{ jdk_src }}:{{ jdk_src }} \ + -e ANDROID_HOME="/home/user/SDKs/Android/Sdk" \ + -e FLUTTER_HOME="/home/user/SDKs/Flutter/flutter" \ + -e JAVA_HOME="/home/user/SDKs/Java" \ + -v {{ user_user.home }}/.gradle:/home/user/.gradle \ + -v {{ user_user.home }}/.pub_cache:/home/user/.pub_cache \ + -e OPEN_TERMINAL_FILE_BROWSER_ROOT="/home/user" \ + -e OPEN_TERMINAL_API_KEY="{{ open_terminal_key }}" \ -e OPEN_TERMINAL_PACKAGES="$packages" \ $image run --port {{ open_terminal_port }} diff --git a/test.yml b/test.yml index 23df97c..ee59f13 100644 --- a/test.yml +++ b/test.yml @@ -18,10 +18,13 @@ ####################### ####################### - - name: TEST | Main + - name: TEST | LLMs block: - - name: LLMs + - name: Java + ansible.builtin.include_tasks: tasks/workstation/linux/software/java.yml + + - name: LLM ansible.builtin.include_tasks: tasks/workstation/linux/software/llm.yml #######################