153 lines
4.1 KiB
YAML
153 lines
4.1 KiB
YAML
---
|
|
# Packages specific to workstations developing Flutter apps.
|
|
|
|
## Facts ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Facts [1/2]
|
|
set_fact:
|
|
flutter_url: "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.27.2-stable.tar.xz"
|
|
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"
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Facts [2/2]
|
|
set_fact:
|
|
flutter_bin_location: "{{ flutter_sdk_location }}/flutter/bin"
|
|
|
|
## Checks ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Check SDK Exists
|
|
stat:
|
|
path: "{{ flutter_sdk_location }}"
|
|
register: flutter_sdk_stat
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Check Download Exists
|
|
stat:
|
|
path: "{{ flutter_download_file }}"
|
|
register: flutter_download_stat
|
|
|
|
## Packages ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Necessities
|
|
package:
|
|
name:
|
|
- curl
|
|
- git
|
|
- unzip
|
|
- xz-utils
|
|
- zip
|
|
- libglu1-mesa
|
|
state: present
|
|
when: coding == true
|
|
|
|
# https://docs.flutter.dev/get-started/install/linux/desktop
|
|
- name: Workstation | Linux | Software | Flutter | Linux App Dependencies
|
|
package:
|
|
name:
|
|
- clang
|
|
- cmake
|
|
- git
|
|
- ninja-build
|
|
- pkg-config
|
|
- libgtk-3-dev
|
|
- liblzma-dev
|
|
- libstdc++-12-dev
|
|
state: present
|
|
when: coding == true
|
|
|
|
# https://docs.flutter.dev/get-started/install/linux/android
|
|
- name: Workstation | Linux | Software | Flutter | Android App Dependencies
|
|
package:
|
|
name:
|
|
- libc6:amd64
|
|
- libstdc++6:amd64
|
|
- lib32z1
|
|
- libbz2-1.0:amd64
|
|
state: present
|
|
when: coding == true
|
|
|
|
## Install SDK ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | SDK
|
|
block:
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Download SDK
|
|
get_url:
|
|
url: "{{ flutter_url }}"
|
|
dest: "{{ flutter_download_file }}"
|
|
owner: "{{ user }}"
|
|
mode: '0664'
|
|
when: not flutter_download_stat.stat.exists
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Create Folder
|
|
file:
|
|
path: "{{ flutter_sdk_location }}"
|
|
state: directory
|
|
owner: "{{ user }}"
|
|
mode: '0755'
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Extract SDK
|
|
unarchive:
|
|
src: "{{ flutter_download_file }}"
|
|
dest: "{{ flutter_sdk_location }}"
|
|
owner: "{{ user }}"
|
|
|
|
when: coding == true and not flutter_sdk_stat.stat.exists
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Delete Archive
|
|
file:
|
|
path: "{{ flutter_download_file }}"
|
|
state: absent
|
|
|
|
## Configure Environment ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Modify PATH (.bashrc)
|
|
blockinfile:
|
|
path: "{{ item }}/.bashrc"
|
|
block: |
|
|
export PATH="$PATH:{{ flutter_bin_location }}"
|
|
marker: '# {mark} MANAGED BY ANSIBLE | Flutter'
|
|
state: present
|
|
create: yes
|
|
backup: yes
|
|
loop:
|
|
- "{{ user_root.home }}"
|
|
- "{{ user_user.home }}"
|
|
ignore_errors: yes
|
|
when: coding == true and user_root.home != "" and user_user.home != ""
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Modify PATH (.zshrc)
|
|
blockinfile:
|
|
path: "{{ item }}/.zshrc"
|
|
block: |
|
|
export PATH="$PATH:{{ flutter_bin_location }}"
|
|
marker: '# {mark} MANAGED BY ANSIBLE | Flutter'
|
|
state: present
|
|
create: yes
|
|
backup: yes
|
|
loop:
|
|
- "{{ user_root.home }}"
|
|
- "{{ user_user.home }}"
|
|
ignore_errors: yes
|
|
when: coding == true and user_root.home != "" and user_user.home != ""
|
|
|
|
## Test SDK ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Doctor Report
|
|
shell: "{{ item }}"
|
|
loop:
|
|
- "date > {{ flutter_report }}"
|
|
- "{{ flutter_bin_location }}/flutter --disable-analytics >> {{ flutter_report }}"
|
|
- "date >> {{ flutter_report }}"
|
|
- "{{ flutter_bin_location }}/flutter doctor -v >> {{ flutter_report }}"
|
|
- "date >> {{ flutter_report }}"
|
|
when: coding == true
|
|
|
|
## Uninstall SDK ##
|
|
|
|
- name: Workstation | Linux | Software | Flutter | Remove SDK
|
|
file:
|
|
path: "{{ flutter_sdk_location }}"
|
|
state: absent
|
|
when: not coding == true
|