diff --git a/localhost.yml b/localhost.yml index c03fa5b..d82244a 100644 --- a/localhost.yml +++ b/localhost.yml @@ -15,11 +15,12 @@ - laptop - desktop - backup + - ego + - firefox + - lutris # - flutter # - virtual -# - lutris -# - ego # - terraform vars: desktop_src_dir: "{{ ansible_user_dir }}/src/desktop" diff --git a/roles/ego/tasks/main.yml b/roles/ego/tasks/main.yml index e742e7b..c820815 100644 --- a/roles/ego/tasks/main.yml +++ b/roles/ego/tasks/main.yml @@ -1,36 +1,4 @@ --- -- name: install required packages for dwm - become: yes - apt: - update_cache: yes - pkg: - - rust-all - - cargo - - libacl1-dev - - x11-xserver-utils - - xdg-desktop-portal-gtk +- import_tasks: ubuntu.yml + when: ansible_distribution == "Ubuntu" -- name: create src dir - file: - path: ~/src - state: directory - -- name: checkout ego - git: - repo: "{{ ego.repo }}" - dest: "{{ desktop_src_dir }}/ego" - clone: yes - update: yes - -- name: build ego - command: cargo install ego - args: - chdir: "{{ desktop_src_dir }}/ego" - -- name: copy ego - become: yes - copy: - remote_src: true - src: "{{ desktop_src_dir }}/.cargo/bin/ego" - dest: /usr/local/bin/ego - mode: '0755' diff --git a/roles/ego/tasks/ubuntu.yml b/roles/ego/tasks/ubuntu.yml new file mode 100644 index 0000000..e742e7b --- /dev/null +++ b/roles/ego/tasks/ubuntu.yml @@ -0,0 +1,36 @@ +--- +- name: install required packages for dwm + become: yes + apt: + update_cache: yes + pkg: + - rust-all + - cargo + - libacl1-dev + - x11-xserver-utils + - xdg-desktop-portal-gtk + +- name: create src dir + file: + path: ~/src + state: directory + +- name: checkout ego + git: + repo: "{{ ego.repo }}" + dest: "{{ desktop_src_dir }}/ego" + clone: yes + update: yes + +- name: build ego + command: cargo install ego + args: + chdir: "{{ desktop_src_dir }}/ego" + +- name: copy ego + become: yes + copy: + remote_src: true + src: "{{ desktop_src_dir }}/.cargo/bin/ego" + dest: /usr/local/bin/ego + mode: '0755' diff --git a/roles/firefox/tasks/main.yml b/roles/firefox/tasks/main.yml index a71b16d..d9de177 100644 --- a/roles/firefox/tasks/main.yml +++ b/roles/firefox/tasks/main.yml @@ -2,4 +2,5 @@ - import_tasks: ppa.yml when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 22 -- import_tasks: update-alternatives.yml \ No newline at end of file +- import_tasks: update-alternatives.yml + when: ansible_distribution == "Ubuntu" diff --git a/roles/intellij/tasks/arch.yml b/roles/intellij/tasks/arch.yml new file mode 100644 index 0000000..9fe8e8c --- /dev/null +++ b/roles/intellij/tasks/arch.yml @@ -0,0 +1,5 @@ +- name: install IntelliJ [AUR] + shell: + cmd: + yay -S --needed --noconfirm \ + intellij-idea-ultimate-edition \ No newline at end of file diff --git a/roles/intellij/tasks/main.yml b/roles/intellij/tasks/main.yml index 4291849..04447f5 100644 --- a/roles/intellij/tasks/main.yml +++ b/roles/intellij/tasks/main.yml @@ -1,33 +1,3 @@ -- name: "Get IntelliJ version" - uri: - url: https://data.services.jetbrains.com/products/releases?code=IIU - body_format: json - register: idea_info - -- name: "Check if intellij is installed" - stat: - path: "{{idea_dir}}/product-info.json" - register: local_version_info_file - -- name: "Check installed version" - when: - - local_version_info_file.stat.exists - shell: cat {{idea_dir}}/product-info.json - register: local_version_info_file - -- name: "Set version info fact" - set_fact: - local_intellij_version: "{{ local_version_info_file.stdout | from_json | json_query('version') }}" - upstream_intellij_version: "{{ idea_info.json | json_query('IIU[0].version') }}" - when: - local_version_inf_file is defined - -- name: "Set version info fact" - set_fact: - local_intellij_version: "0.0" - upstream_intellij_version: "{{ idea_info.json | json_query('IIU[0].version') }}" - when: - local_version_inf_file is undefined - -- import_tasks: install.yml - when: local_version_info_file is undefined or local_intellij_version != upstream_intellij_version +--- +- import_tasks: ubuntu.yml + when: ansible_distribution == "Ubuntu" diff --git a/roles/intellij/tasks/ubuntu.yml b/roles/intellij/tasks/ubuntu.yml new file mode 100644 index 0000000..4291849 --- /dev/null +++ b/roles/intellij/tasks/ubuntu.yml @@ -0,0 +1,33 @@ +- name: "Get IntelliJ version" + uri: + url: https://data.services.jetbrains.com/products/releases?code=IIU + body_format: json + register: idea_info + +- name: "Check if intellij is installed" + stat: + path: "{{idea_dir}}/product-info.json" + register: local_version_info_file + +- name: "Check installed version" + when: + - local_version_info_file.stat.exists + shell: cat {{idea_dir}}/product-info.json + register: local_version_info_file + +- name: "Set version info fact" + set_fact: + local_intellij_version: "{{ local_version_info_file.stdout | from_json | json_query('version') }}" + upstream_intellij_version: "{{ idea_info.json | json_query('IIU[0].version') }}" + when: + local_version_inf_file is defined + +- name: "Set version info fact" + set_fact: + local_intellij_version: "0.0" + upstream_intellij_version: "{{ idea_info.json | json_query('IIU[0].version') }}" + when: + local_version_inf_file is undefined + +- import_tasks: install.yml + when: local_version_info_file is undefined or local_intellij_version != upstream_intellij_version diff --git a/roles/jetbrains/tasks/main.yml b/roles/jetbrains/tasks/main.yml index 5a2f639..fbbfa7f 100644 --- a/roles/jetbrains/tasks/main.yml +++ b/roles/jetbrains/tasks/main.yml @@ -1,9 +1,6 @@ --- -- stat: - path: /usr/local/bin/jetbrains-toolbox - register: toolbox_binary - - import_tasks: jetbrains-toolbox.yml - when: not toolbox_binary.stat.exists + when: ansible_distribution == "Ubuntu" - import_tasks: system-setup.yml + when: ansible_distribution == "Ubuntu" diff --git a/roles/lutris/tasks/arch.yml b/roles/lutris/tasks/arch.yml new file mode 100644 index 0000000..f05db49 --- /dev/null +++ b/roles/lutris/tasks/arch.yml @@ -0,0 +1,5 @@ +- name: install lutris + become: yes + community.general.pacman: + name: + - lutris diff --git a/roles/lutris/tasks/main.yml b/roles/lutris/tasks/main.yml index bab6c47..97284fc 100644 --- a/roles/lutris/tasks/main.yml +++ b/roles/lutris/tasks/main.yml @@ -1,32 +1,6 @@ --- -- become: yes - block: - - name: Add i386 Architecture - command: dpkg --add-architecture i386 +- import_tasks: ubuntu.yml + when: ansible_distribution == "Ubuntu" - - name: Update APT Cache for i386 - apt: - update_cache: true - - - name: remove old ppa repository - apt_repository: - repo: ppa:lutris-team/lutris - state: absent - - - name: install lutris libraries - apt: - update_cache: yes - pkg: - - wine - - steam - -- name: "Get Lutris version" - uri: - url: https://api.github.com/repos/lutris/lutris/releases/latest - body_format: json - register: git_info - -- name: Install deb package - become: yes - apt: - deb: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*deb'))[0] }}" +- import_tasks: arch.yml + when: ansible_distribution == "Archlinux" diff --git a/roles/lutris/tasks/ubuntu.yml b/roles/lutris/tasks/ubuntu.yml new file mode 100644 index 0000000..bab6c47 --- /dev/null +++ b/roles/lutris/tasks/ubuntu.yml @@ -0,0 +1,32 @@ +--- +- become: yes + block: + - name: Add i386 Architecture + command: dpkg --add-architecture i386 + + - name: Update APT Cache for i386 + apt: + update_cache: true + + - name: remove old ppa repository + apt_repository: + repo: ppa:lutris-team/lutris + state: absent + + - name: install lutris libraries + apt: + update_cache: yes + pkg: + - wine + - steam + +- name: "Get Lutris version" + uri: + url: https://api.github.com/repos/lutris/lutris/releases/latest + body_format: json + register: git_info + +- name: Install deb package + become: yes + apt: + deb: "{{ (git_info.json | json_query('assets[*].browser_download_url') | select('match', '.*deb'))[0] }}"