Add RedHat support to the obsidian role
This commit is contained in:
parent
db0b181473
commit
0b71c22019
5
roles/obsidian/handlers/main.yaml
Normal file
5
roles/obsidian/handlers/main.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: install desktop menu
|
||||
command: >
|
||||
xdg-desktop-menu install --mode user
|
||||
{{ansible_env.HOME}}/.local/share/applications/obsidian-obsidian.desktop
|
@ -4,8 +4,4 @@
|
||||
name: obsidian
|
||||
state: latest
|
||||
|
||||
- name: clone notes repository
|
||||
git:
|
||||
repo: git@github.com:kbenzie/notes.git
|
||||
dest: '{{ansible_env.HOME}}/Documents/Notes'
|
||||
version: main
|
||||
- include_tasks: Unix.yaml
|
||||
|
48
roles/obsidian/tasks/RedHat.yaml
Normal file
48
roles/obsidian/tasks/RedHat.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
- name: stat symlink
|
||||
stat:
|
||||
path: '{{ansible_env.HOME}}/.local/bin/Obsidian'
|
||||
register: symlink_file
|
||||
|
||||
- name: get latest release
|
||||
uri:
|
||||
url: https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest
|
||||
register: latest
|
||||
|
||||
- set_fact:
|
||||
appimage: 'Obsidian-{{latest.json.name}}.AppImage'
|
||||
- set_fact:
|
||||
filepath: '{{ansible_env.HOME}}/.local/bin/{{appimage}}'
|
||||
asset_query: '[?contains(name, `{{appimage}}`)] | [0]'
|
||||
- set_fact:
|
||||
needs_installed:
|
||||
'{{not symlink_file.stat.exists or symlink_file.stat.lnk_source != filepath}}'
|
||||
asset: '{{latest.json.assets | to_json | from_json | json_query(asset_query)}}'
|
||||
|
||||
- name: download latest version
|
||||
get_url:
|
||||
url: '{{asset.browser_download_url}}'
|
||||
dest: '{{filepath}}'
|
||||
mode: '0755'
|
||||
|
||||
- name: create symlink
|
||||
file:
|
||||
src: '{{filepath}}'
|
||||
dest: '{{ansible_env.HOME}}/.local/bin/Obsidian'
|
||||
state: link
|
||||
|
||||
# TODO: icon for desktop file
|
||||
|
||||
- name: create desktop file
|
||||
template:
|
||||
src: obsidian.desktop.j2
|
||||
dest: '{{ansible_env.HOME}}/.local/share/applications/obsidian-obsidian.desktop'
|
||||
notify: install desktop menu
|
||||
|
||||
- name: remove old appimage
|
||||
when: needs_installed and symlink_file.stat.exists
|
||||
file:
|
||||
path: '{{symlink_file.stat.lnk_source}}'
|
||||
state: absent
|
||||
|
||||
- include_tasks: Unix.yaml
|
6
roles/obsidian/tasks/Unix.yaml
Normal file
6
roles/obsidian/tasks/Unix.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: clone notes repository
|
||||
git:
|
||||
repo: git@github.com:kbenzie/notes.git
|
||||
dest: '{{ansible_env.HOME}}/Documents/Notes'
|
||||
version: main
|
11
roles/obsidian/templates/obsidian.desktop.j2
Normal file
11
roles/obsidian/templates/obsidian.desktop.j2
Normal file
@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Name=Obsidian
|
||||
Exec={{ansible_env.HOME}}/.local/bin/Obsidian
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=obsidian
|
||||
StartupWMClass=Obsidian
|
||||
X-AppImage-Version={{latest.json.name}}
|
||||
Comment=Private and flexible note‑taking app that adapts to the way you think.
|
||||
MimeType=x-scheme-handler/obsidian;
|
||||
Categories=Utility;
|
Loading…
x
Reference in New Issue
Block a user