diff --git a/setup.yml b/setup.yml index c344cda..522947d 100644 --- a/setup.yml +++ b/setup.yml @@ -36,3 +36,5 @@ - ansible.builtin.import_tasks: tasks/user_config.yml - ansible.builtin.import_tasks: tasks/pcloud.yml when: install_pcloud + - ansible.builtin.import_tasks: tasks/typora.yml + when: install_typora diff --git a/tasks/typora.yml b/tasks/typora.yml new file mode 100644 index 0000000..4781cd5 --- /dev/null +++ b/tasks/typora.yml @@ -0,0 +1,64 @@ +--- +- name: Create Typora install directory + ansible.builtin.file: + path: /opt/typora + state: directory + owner: root + group: root + mode: "0755" + +- name: Download Typora Linux binary archive + ansible.builtin.get_url: + url: "{{ typora_archive_url }}" + dest: "{{ typora_archive }}" + mode: "0644" + timeout: 300 + +- name: Extract Typora + ansible.builtin.unarchive: + src: "{{ typora_archive }}" + dest: /opt/typora + remote_src: true + owner: root + group: root + mode: "0755" + +- name: Ensure Typora files are readable + ansible.builtin.file: + path: /opt/typora + state: directory + owner: root + group: root + mode: "0755" + recurse: true + +- name: Create Typora launcher wrapper + ansible.builtin.copy: + dest: /usr/local/bin/typora + mode: "0755" + content: | + #!/usr/bin/env bash + set -euo pipefail + + cd /opt/typora/bin/Typora-linux-x64 + exec /opt/typora/bin/Typora-linux-x64/Typora "$@" + +- name: Ensure system desktop application directory exists + ansible.builtin.file: + path: /usr/local/share/applications + state: directory + mode: "0755" + +- name: Create Typora desktop launcher + ansible.builtin.copy: + dest: /usr/local/share/applications/typora.desktop + mode: "0644" + content: | + [Desktop Entry] + Type=Application + Name=Typora + Comment=Markdown editor + Exec=/usr/local/bin/typora %F + Terminal=false + Categories=Office;WordProcessor;TextEditor; + MimeType=text/markdown;text/x-markdown; diff --git a/vars.yml b/vars.yml index c6783ef..9897ecc 100644 --- a/vars.yml +++ b/vars.yml @@ -24,6 +24,9 @@ install_sqlcmd: true install_jdtls: true install_pcloud: true pcloud_appimage_url: "https://plon1.pcloud.com/cBZeyCak57Ztkt7yq7ZZZ8t965kZ2ZZec4ZkZ9KHBHZJgZCzZrLZeFZ94ZkLZ5LZWQZr4Z6YZrFZmLZyQZoTZtwII5ZsVYEJTHXlFSbr5cyP1riD5WTyYYV/pCloud.AppImage" +install_typora: true +typora_archive_url: https://downloads.typora.io/linux/Typora-linux-x64.tar.gz +typora_archive: /tmp/Typora-linux-x64.tar.gz fedora_packages: # Media and documents