Pārlūkot izejas kodu

several installation methods

master
vecāks
revīzija
e4f2102de6
9 mainītis faili ar 78 papildinājumiem un 48 dzēšanām
  1. +3
    -0
      defaults/main.yaml
  2. +6
    -0
      tasks/apt.yaml
  3. +13
    -0
      tasks/flatpak.yaml
  4. +0
    -32
      tasks/git-setup.yaml
  5. +40
    -0
      tasks/git.yaml
  6. +4
    -5
      tasks/main.yaml
  7. +11
    -0
      tasks/snap.yaml
  8. +0
    -11
      tasks/uninstall-git-setup.yaml
  9. +1
    -0
      vars/main.yaml

+ 3
- 0
defaults/main.yaml Parādīt failu

@@ -1 +1,4 @@
---
telegram_source: flatpak
telegram_opt_directory: /opt/telegram-desktop
telegram_git_releases_url: https://api.github.com/repos/telegramdesktop/tdesktop/releases/latest

+ 6
- 0
tasks/apt.yaml Parādīt failu

@@ -0,0 +1,6 @@
---

- name: telegram-desktop apt package
apt:
pkg: telegram-desktop
state: "{{ (telegram_source == 'apt') | ternary('latest','absent') }}"

+ 13
- 0
tasks/flatpak.yaml Parādīt failu

@@ -0,0 +1,13 @@
---

- name: flatpak apt package
apt:
pkg: flatpak
when: telegram_source == 'flatpak'

- name: telegram-desktop flatpak package
community.general.flatpak:
remote: flathub
name: org.telegram.desktop
state: "{{ (telegram_source == 'flatpak') | ternary('present','absent') }}"
ignore_errors: "{{telegram_source != 'flatpak'}}"

+ 0
- 32
tasks/git-setup.yaml Parādīt failu

@@ -1,32 +0,0 @@
---

- name: installation directory
file:
path: /opt/telegram-desktop
state: directory

- name: get telegram-desktop releases
uri:
url: https://api.github.com/repos/telegramdesktop/tdesktop/releases/latest
return_content: true
register: _telegram_desktop_releases

- name: download latest release
get_url:
url: "{{_telegram_desktop_dl_url}}"
dest: /opt/telegram-desktop/{{_telegram_desktop_dl_filename}}

- name: extract telegram release
unarchive:
src: /opt/telegram-desktop/{{_telegram_desktop_dl_filename}}
remote_src: true
dest: /opt/telegram-desktop
mode: u=rwx,g=rx,o=rx
owner: root
group: root

- name: link telegram-desktop binary
file:
src: /opt/telegram-desktop/Telegram/Telegram
dest: /usr/local/bin/telegram-desktop
state: link

+ 40
- 0
tasks/git.yaml Parādīt failu

@@ -0,0 +1,40 @@
---

- name: installation directory
file:
path: "{{telegram_opt_directory}}"
state: "{{ (telegram_source == 'git') | ternary('directory','absent') }}"

- when: telegram_source == 'git'
block:
- name: get telegram-desktop releases
uri:
url: "{{telegram_git_releases_url}}"
return_content: true
register: _telegram_desktop_releases

- name: download latest release
get_url:
url: "{{_telegram_desktop_dl_url}}"
dest: "{{_telegram_desktop_dl_dest}}"

- name: extract telegram release
unarchive:
src: "{{_telegram_desktop_dl_dest}}"
remote_src: true
dest: "{{telegram_opt_directory}}"
mode: u=rwx,g=rx,o=rx
owner: root
group: root

- name: link telegram-desktop binary
file:
src: "{{telegram_opt_directory}}/Telegram/Telegram"
dest: /usr/local/bin/telegram-desktop
state: link

- name: unlink telegram-desktop binary
file:
path: /usr/local/bin/telegram-desktop
state: absent
when: telegram_source != 'git'

+ 4
- 5
tasks/main.yaml Parādīt failu

@@ -1,7 +1,6 @@
---

- import_tasks: uninstall-git-setup.yaml

- name: telegram-desktop debian package
apt:
pkg: telegram-desktop
- import_tasks: apt.yaml
- import_tasks: flatpak.yaml
- import_tasks: snap.yaml
- import_tasks: git.yaml

+ 11
- 0
tasks/snap.yaml Parādīt failu

@@ -0,0 +1,11 @@
---
- name: flatpak apt package
apt:
pkg: snap
when: telegram_source == 'snap'

- name: telegram-desktop snap package
community.general.snap:
name: telegram-desktop
state: "{{ (telegram_source == 'snap') | ternary('present','absent') }}"
ignore_errors: "{{telegram_source != 'snap'}}"

+ 0
- 11
tasks/uninstall-git-setup.yaml Parādīt failu

@@ -1,11 +0,0 @@
---

- name: installation directory absent
file:
path: /opt/telegram-desktop
state: absent

- name: unlink telegram-desktop binary
file:
path: /usr/local/bin/telegram-desktop
state: absent

+ 1
- 0
vars/main.yaml Parādīt failu

@@ -1,3 +1,4 @@
---
_telegram_desktop_dl_url: "{{ _telegram_desktop_releases.json.assets | json_query(\"[?label=='Linux 64 bit: Binary'].browser_download_url|[0]\") }}"
_telegram_desktop_dl_filename: "{{ _telegram_desktop_releases.json.assets | json_query(\"[?label=='Linux 64 bit: Binary'].name|[0]\") }}"
_telegram_desktop_dl_dest: "{{telegram_opt_directory}}/{{_telegram_desktop_dl_filename}}"

Notiek ielāde…
Atcelt
Saglabāt