From 006e82979df56388e16a24fdff078d6200d0dc4a Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Sun, 20 Aug 2023 14:14:45 +0200 Subject: [PATCH] Add flutter --- localhost.yml | 5 ++-- roles/flutter/tasks/install.yml | 46 +++++++++++++++++++++++++++++++++ roles/flutter/tasks/main.yml | 8 ++++++ roles/flutter/vars/main.yml | 4 +++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 roles/flutter/tasks/install.yml create mode 100644 roles/flutter/tasks/main.yml create mode 100644 roles/flutter/vars/main.yml diff --git a/localhost.yml b/localhost.yml index e4d5487..e8956be 100644 --- a/localhost.yml +++ b/localhost.yml @@ -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 \ No newline at end of file + desktop_src_dir: "{{ ansible_user_dir }}/src/desktop" \ No newline at end of file diff --git a/roles/flutter/tasks/install.yml b/roles/flutter/tasks/install.yml new file mode 100644 index 0000000..b0a55cc --- /dev/null +++ b/roles/flutter/tasks/install.yml @@ -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 diff --git a/roles/flutter/tasks/main.yml b/roles/flutter/tasks/main.yml new file mode 100644 index 0000000..4659e11 --- /dev/null +++ b/roles/flutter/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/roles/flutter/vars/main.yml b/roles/flutter/vars/main.yml new file mode 100644 index 0000000..70da778 --- /dev/null +++ b/roles/flutter/vars/main.yml @@ -0,0 +1,4 @@ +--- +tmp_dir: /tmp/flutter +flutter_dir: /opt/flutter +version: 3.13.0 \ No newline at end of file