From 08ffca5366352219436703acbe4777276347cb96 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 17 Sep 2016 19:14:40 +0200 Subject: [PATCH 1/2] add executable and desktop icon --- tasks/main.yml | 10 ++++++++++ templates/empty | 0 templates/pycharm.desktop.j2 | 11 +++++++++++ templates/pycharm.j2 | 4 ++++ vars/main.yml | 2 ++ 5 files changed, 27 insertions(+) delete mode 100644 templates/empty create mode 100644 templates/pycharm.desktop.j2 create mode 100644 templates/pycharm.j2 diff --git a/tasks/main.yml b/tasks/main.yml index 15e66ec..d5acd77 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -34,3 +34,13 @@ - configuration - pycharm - pycharm-install + +- name: Retrieve pycharm dir name + command: "ls -t {{ pycharm_install_prefix }}" + register: result_pycharm_folder_name + +- name: Ensure pycharm bin exist + template: src=pycharm.j2 dest=/usr/bin/pycharm mode=755 + +- name: Ensure pycharm shortcut is present + template: src=pycharm.desktop.j2 dest=/usr/share/applications/pycharm.desktop diff --git a/templates/empty b/templates/empty deleted file mode 100644 index e69de29..0000000 diff --git a/templates/pycharm.desktop.j2 b/templates/pycharm.desktop.j2 new file mode 100644 index 0000000..79f791c --- /dev/null +++ b/templates/pycharm.desktop.j2 @@ -0,0 +1,11 @@ +# {{ ansible_managed }} +[Desktop Entry] +Encoding=UTF-8 +Name=PyCharm +Comment=PyCharm +Exec=pycharm +Icon={{ pycharm_install_prefix }}/{{ pycharm_folder_name }}/bin/pycharm.png +Terminal=false +Type=Application +Categories=GNOME;Application;Development; +StartupNotify=true \ No newline at end of file diff --git a/templates/pycharm.j2 b/templates/pycharm.j2 new file mode 100644 index 0000000..d5ea46f --- /dev/null +++ b/templates/pycharm.j2 @@ -0,0 +1,4 @@ +#!/bin/sh +export PYCHARM_HOME="{{ pycharm_install_prefix }}/{{ pycharm_folder_name }}/bin" + +$PYCHARM_HOME/pycharm.sh $* diff --git a/vars/main.yml b/vars/main.yml index 69d307d..342feb7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,5 @@ # vars file for pycharm --- pycharm_downloads_path: /var/lib/ansible/pycharm/downloads + +pycharm_folder_name: "{{ result_pycharm_folder_name.stdout_lines.0 }}" \ No newline at end of file From e8d47c618134d3c8adef0ff980585078f5be1cb2 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 17 Sep 2016 21:12:23 +0200 Subject: [PATCH 2/2] ensure idempotency --- tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/main.yml b/tasks/main.yml index d5acd77..c199780 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -38,6 +38,7 @@ - name: Retrieve pycharm dir name command: "ls -t {{ pycharm_install_prefix }}" register: result_pycharm_folder_name + changed_when: no - name: Ensure pycharm bin exist template: src=pycharm.j2 dest=/usr/bin/pycharm mode=755