Add flutter
This commit is contained in:
parent
039ebe3bac
commit
006e82979d
@ -1,7 +1,7 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- ubuntu
|
||||
# - ubuntu
|
||||
# - dwm
|
||||
# - firefox
|
||||
# - docker
|
||||
@ -18,5 +18,6 @@
|
||||
# - chromium
|
||||
# - terraform
|
||||
# - no-snap
|
||||
- flutter
|
||||
vars:
|
||||
desktop_src_dir: {{ ansible_user_dir }}/src/desktop
|
||||
desktop_src_dir: "{{ ansible_user_dir }}/src/desktop"
|
46
roles/flutter/tasks/install.yml
Normal file
46
roles/flutter/tasks/install.yml
Normal file
@ -0,0 +1,46 @@
|
||||
- name: install jmespath for json_query
|
||||
become: yes
|
||||
apt:
|
||||
update_cache: yes
|
||||
pkg:
|
||||
- python3-jmespath
|
||||
|
||||
- name: Create temp dir
|
||||
file:
|
||||
path: "{{ tmp_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: "Flutter"
|
||||
become: yes
|
||||
unarchive:
|
||||
src: "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_{{ version }}-stable.tar.xz"
|
||||
dest: "{{ tmp_dir }}"
|
||||
remote_src: yes
|
||||
|
||||
- name: get folder name
|
||||
shell: ls "{{ tmp_dir }}"
|
||||
register: dir_name
|
||||
|
||||
- name: Copy to final directory
|
||||
become: yes
|
||||
command: "cp -ra {{ tmp_dir }}/{{ dir_name.stdout }} {{ flutter_dir }}"
|
||||
|
||||
- name: Remove temp directory
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ tmp_dir }}"
|
||||
state: absent
|
||||
|
||||
- name: Create symbolic link for flutter
|
||||
become: yes
|
||||
file:
|
||||
src: "/opt/flutter/bin/flutter"
|
||||
dest: "/usr/local/bin/flutter"
|
||||
state: link
|
||||
|
||||
- name: Create symbolic link for dart
|
||||
become: yes
|
||||
file:
|
||||
src: "/opt/flutter/bin/dart"
|
||||
dest: "/usr/local/bin/dart"
|
||||
state: link
|
8
roles/flutter/tasks/main.yml
Normal file
8
roles/flutter/tasks/main.yml
Normal file
@ -0,0 +1,8 @@
|
||||
- name: Check if old version exists
|
||||
stat:
|
||||
path: "{{ flutter_dir }}"
|
||||
register: flutter_dir_status
|
||||
|
||||
- import_tasks: install.yml
|
||||
when:
|
||||
- not flutter_dir_status.stat.exists
|
4
roles/flutter/vars/main.yml
Normal file
4
roles/flutter/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
tmp_dir: /tmp/flutter
|
||||
flutter_dir: /opt/flutter
|
||||
version: 3.13.0
|
Loading…
Reference in New Issue
Block a user