Compare commits

...

3 Commits

3 changed files with 52 additions and 18 deletions

View File

@ -12,28 +12,41 @@
# Command-line tools is all Flutter actually needs:
# https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
- name: Workstation | Linux | Software | Android | Facts [1/2]
- name: Workstation | Linux | Software | Android | Facts [1/3]
set_fact:
android_url: "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"
android_download_file: "{{ user_user.home }}/Downloads/android-cmdline-tools.tar.xz"
android_sdk_location: "{{ user_user.home }}/SDKs/Android/Sdk"
- name: Workstation | Linux | Software | Android | Facts [2/2]
- name: Workstation | Linux | Software | Android | Facts [2/3]
set_fact:
android_bin_location: "{{ android_sdk_location }}/platform-tools"
android_sdkmanager: "{{ android_sdk_location }}/cmdline-tools/bin/sdkmanager"
android_sdk_location_temp: "{{ android_sdk_location }}/ansible"
android_sdkmanager_final: "{{ android_sdk_location }}/cmdline-tools/latest/bin/sdkmanager"
- name: Workstation | Linux | Software | Android | Facts [3/3]
set_fact:
android_sdkmanager_temp: "{{ android_sdk_location_temp }}/cmdline-tools/bin/sdkmanager"
## Checks ##
- name: Workstation | Linux | Software | Android | Check SDK Exists
- name: Workstation | Linux | Software | Android | Check SDK Manager Exists [1/2]
stat:
path: "{{ android_bin_location }}"
register: android_sdk_stat
path: "{{ android_sdkmanager_temp }}"
register: android_sdkmanager_temp_stat
when: coding == true
- name: Workstation | Linux | Software | Android | Check SDK Manager Exists [2/2]
stat:
path: "{{ android_sdkmanager_final }}"
register: android_sdkmanage_final_stat
when: coding == true
- name: Workstation | Linux | Software | Android | Check Download Exists
stat:
path: "{{ android_download_file }}"
register: android_download_stat
when: coding == true
## Packages ##
@ -86,7 +99,7 @@
owner: "{{ user }}"
group: "{{ user }}"
when: coding == true and not android_sdk_stat.stat.exists
when: coding == true and not android_sdkmanager_temp_stat.stat.exists
- name: Workstation | Linux | Software | Android | Delete Archive
file:
@ -95,13 +108,21 @@
## Configure Modules ##
- name: Workstation | Linux | Software | Android | Install Modules
shell: "yes | {{ android_sdkmanager }} '{{ item }}' --sdk_root={{ android_sdk_location }}"
# This can only be run once, otherwise cmdline-tools creates latest-* folders.
- name: Workstation | Linux | Software | Android | Install Consistent Modules
shell: "yes | {{ android_sdkmanager_temp }} --install '{{ item }}' --sdk_root={{ android_sdk_location }}"
loop:
# latest
# Current
- cmdline-tools;latest
- platform-tools
- emulator
become_user: "{{ user }}"
when: coding == true and not android_sdkmanager_final_stat.stat.exists
# These are safe to run multiple times.
- name: Workstation | Linux | Software | Android | Install Modules
shell: "yes | {{ android_sdkmanager_final }} --install '{{ item }}' --sdk_root={{ android_sdk_location }}"
loop:
# 34
- build-tools;34.0.0
- platforms;android-34
@ -112,22 +133,31 @@
- platforms;android-35
- sources;android-35
# Images
- system-images;android-35;default;x86_64
- system-images;android-35;aosp_atd;x86_64
#- system-images;android-35;default;x86_64
#- system-images;android-35;aosp_atd;x86_64
- system-images;android-35;google_apis_playstore;x86_64
become_user: "{{ user }}"
when: coding == true and not android_sdkmanager_final_stat.stat.exists
- name: Workstation | Linux | Software | Android | Update Modules
shell: "yes | {{ android_sdkmanager }} --update --sdk_root={{ android_sdk_location }}"
shell: "yes | {{ android_sdkmanager_final }} --update --sdk_root={{ android_sdk_location }}"
become_user: "{{ user }}"
when: coding == true
- name: Workstation | Linux | Software | Android | Inform Flutter
shell: "{{ flutter }} config --android-sdk={{ android_sdk_location }}"
become_user: "{{ user }}"
when: coding == true
- name: Workstation | Linux | Software | Android | License Agreements
- name: Workstation | Linux | Software | Android | Licenses Agreements [1/2]
shell: "yes | {{ android_sdkmanager_final }} --licenses --android-sdk={{ android_sdk_location }}"
become_user: "{{ user }}"
when: coding == true
- name: Workstation | Linux | Software | Android | License Agreements [2/2]
shell: "yes | {{ flutter }} doctor --android-licenses"
become_user: "{{ user }}"
when: coding == true
- name: Workstation | Linux | Software | Android | Refresh Flutter Doctor Report
shell: "{{ item }}"
@ -141,7 +171,7 @@
blockinfile:
path: "{{ item }}/.bashrc"
block: |
export PATH="$PATH:{{ android_bin_location }}"
export PATH="$PATH:{{ android_bin_location }}:{{ android_sdkmanager_final }}"
marker: '# {mark} MANAGED BY ANSIBLE | Android'
state: present
create: yes
@ -156,7 +186,7 @@
blockinfile:
path: "{{ item }}/.zshrc"
block: |
export PATH="$PATH:{{ android_bin_location }}"
export PATH="$PATH:{{ android_bin_location }}:{{ android_sdkmanager_final }}"
marker: '# {mark} MANAGED BY ANSIBLE | Android'
state: present
create: yes

View File

@ -9,14 +9,17 @@
flutter_download_file: "{{ user_user.home }}/Downloads/flutter.tar.xz"
flutter_sdk_location: "{{ user_user.home }}/SDKs/Flutter"
flutter_report: "{{ user_user.home }}/Reports/flutter.txt"
when: coding == true
- name: Workstation | Linux | Software | Flutter | Facts [2/4]
set_fact:
flutter_bin_location: "{{ flutter_sdk_location }}/flutter/bin"
when: coding == true
- name: Workstation | Linux | Software | Flutter | Facts [3/4]
set_fact:
flutter: "{{ flutter_bin_location }}/flutter"
when: coding == true
- name: Workstation | Linux | Software | Flutter | Facts [3/3]
set_fact:
@ -26,6 +29,7 @@
- "date >> {{ flutter_report }}"
- "{{ flutter }} doctor -v >> {{ flutter_report }}"
- "date >> {{ flutter_report }}"
when: coding == true
## Checks ##
@ -33,11 +37,13 @@
stat:
path: "{{ flutter_sdk_location }}"
register: flutter_sdk_stat
when: coding == true
- name: Workstation | Linux | Software | Flutter | Check Download Exists
stat:
path: "{{ flutter_download_file }}"
register: flutter_download_stat
when: coding == true
## Packages ##

View File

@ -38,8 +38,6 @@
- "{{ appimagelauncher }}"
- "{{ evolution }}"
- "{{ evolution }}*"
- adb
- fastboot
- gparted
state: present