---
- name: Install needed dependancies
  action: "{{ ansible_pkg_mgr }} state=present name={{ item }}"
  with_items:
    - tar
    - unzip
  tags: ["packages","intellij"]

- name: Download intellij
  get_url: url={{intellij_url}} dest={{intellij_tmp}}
  tags: ["packages","intellij"]

- name: Ensure installation directory
  file:
    state=directory
    mode=0755
    dest={{intellij_install_dir}}
  tags: ["packages","intellij"]

- name: Unarchive intellij
  unarchive:
    copy=no
    src={{intellij_tmp}}
    dest={{intellij_install_dir}}
  tags: ["packages","intellij"]

- name: Retreive intellij dir name
  command: ls -tC {{intellij_install_dir}}
  register: result_intellij_folder_name
  tags: ["configuration","intellij"]

- name: Ensure intellij is configured
  template: src=idea.properties.j2 dest={{intellij_install_dir}}/{{intellij_folder_name}}/bin/idea.properties
  tags: ["configuration","intellij"]

- name: Ensure intellij bin exist
  template: src=intellij.j2 dest=/usr/bin/intellij mode=755
  tags: ["configuration","intellij"]

- name: Ensure intellij shortcut is present
  template: src=intellij.desktop.j2 dest=/usr/share/applications/intellij.desktop
  tags: ["configuration","intellij"]
---
- name: Install needed dependancies
  action: "{{ ansible_pkg_mgr }} state=present name={{ item }}"
  with_items:
    - tar
    - unzip
  tags: ["packages","intellij"]

- name: Download intellij
  get_url: url={{intellij_url}} dest={{intellij_tmp}}
  tags: ["packages","intellij"]

- name: Ensure installation directory
  file:
    state=directory
    mode=0755
    dest={{intellij_install_dir}}
  tags: ["packages","intellij"]

- name: Unarchive intellij
  unarchive:
    copy=no
    src={{intellij_tmp}}
    dest={{intellij_install_dir}}
  tags: ["packages","intellij"]

- name: Retreive intellij dir name
  command: ls -t {{intellij_install_dir}}
  register: result_intellij_folder_name
  tags: ["configuration","intellij"]

- name: Ensure intellij is configured
  template: src=idea.properties.j2 dest={{intellij_install_dir}}/{{intellij_folder_name}}/bin/idea.properties
  tags: ["configuration","intellij"]

- name: Ensure intellij bin exist
  template: src=intellij.j2 dest=/usr/bin/intellij mode=755
  tags: ["configuration","intellij"]

- name: Ensure intellij shortcut is present
  template: src=intellij.desktop.j2 dest=/usr/share/applications/intellij.desktop
  tags: ["configuration","intellij"]
Correct install when new version is installed
Correct install when new version is installed
