--- - 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'