main.yml 1.2 KB
Newer Older
julian.gethmann's avatar
julian.gethmann committed
1
---
2 3 4 5 6 7 8 9 10 11 12
- name: check if PyCharm is installed
  stat:
    path: "/usr/local/pycharm/{{ pycharm_name | regex_replace('-professional') }}"
  register: pycharm_installation

- name: create temporary download directory
  tempfile:
    state: directory
  register: tmpdir
  when: not (pycharm_installation.stat.isdir is defined and pycharm_installation.stat.isdir)

julian.gethmann's avatar
julian.gethmann committed
13 14
- name: download PyCharm
  get_url:
15
    url: "https://download-cf.jetbrains.com/python/{{ pycharm_name }}.tar.gz"
16 17
    dest: "{{ tmpdir.path }}/pycharm.tar.gz"
  when: tmpdir.changed
julian.gethmann's avatar
julian.gethmann committed
18

19
- name: Create directory
julian.gethmann's avatar
julian.gethmann committed
20 21
  become: yes
  file:
22
    path: /usr/local/pycharm
julian.gethmann's avatar
julian.gethmann committed
23 24
    state: directory

25
- name: Unarchive
julian.gethmann's avatar
julian.gethmann committed
26 27 28
  become: yes
  unarchive:
    src: /tmp/pycharm.tar.gz
29
    dest: /usr/local/pycharm
julian.gethmann's avatar
julian.gethmann committed
30
    remote_src: yes
31
    creates: "/usr/local/pycharm/{{ pycharm_name | regex_replace('-professional') }}"
32

33
- name: Link PyCharm
34 35 36 37
  become: yes
  file:
    mode: o+rx
    path: /usr/local/bin/pycharm
38
    src: "/usr/local/pycharm/{{ pycharm_name | regex_replace('-professional') }}/bin/pycharm.sh"
39
    state: link
julian.gethmann's avatar
julian.gethmann committed
40 41 42 43 44 45 46

- name: Add Desktop-icon
  template:
    src: PyCharm.desktop.j2
    dest: "/home/{{ user_account }}/Desktop/PyCharm.desktop"
    backup: yes
    owner: "{{ user_account }}"