Compare commits
2 Commits
5309683d94
...
b970cbc8ca
Author | SHA1 | Date | |
---|---|---|---|
b970cbc8ca | |||
e330c3d072 |
@ -46,5 +46,5 @@
|
|||||||
when: install_required
|
when: install_required
|
||||||
become: true
|
become: true
|
||||||
command:
|
command:
|
||||||
cmd: 'stow --target /usr/local .'
|
cmd: 'stow --no-folding --target /usr/local .'
|
||||||
chdir: '{{tea_package_dir}}'
|
chdir: '{{tea_package_dir}}'
|
||||||
|
@ -1,6 +1,98 @@
|
|||||||
---
|
---
|
||||||
- name: install apt package
|
- name: remove apt package
|
||||||
become: true
|
become: true
|
||||||
apt:
|
apt:
|
||||||
name: kitty
|
name: kitty
|
||||||
state: latest
|
state: absent
|
||||||
|
|
||||||
|
- name: get latest version
|
||||||
|
uri:
|
||||||
|
url: https://api.github.com/repos/kovidgoyal/kitty/releases/latest
|
||||||
|
headers: '{{github_auth_headers}}'
|
||||||
|
register: latest
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
kitty_latest_version: '{{latest.json.tag_name[1:]}}'
|
||||||
|
kitty_exe: /usr/local/bin/kitty
|
||||||
|
kitty_package_dir: /usr/local/stow/kitty
|
||||||
|
|
||||||
|
- name: check if already installed
|
||||||
|
stat:
|
||||||
|
path: '{{kitty_exe}}'
|
||||||
|
register: kitty
|
||||||
|
|
||||||
|
- name: get installed version
|
||||||
|
when: kitty.stat.exists
|
||||||
|
command: '{{kitty_exe}} --version'
|
||||||
|
register: kitty_version
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- when: kitty.stat.exists
|
||||||
|
set_fact:
|
||||||
|
kitty_install_version:
|
||||||
|
'{{kitty_version.stdout | regex_replace("^.*(\d+\.\d+\.\d+).*$", "\1")}}'
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
kitty_asset_query: >
|
||||||
|
[? contains(name,
|
||||||
|
`kitty-{{kitty_latest_version}}-{{ansible_architecture}}.txz`)] | [0]
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
kitty_install_required: >
|
||||||
|
{{ kitty_install_version is not defined or
|
||||||
|
kitty_latest_version != kitty_install_version }}
|
||||||
|
kitty_asset: "{{ latest.json.assets | json_query(kitty_asset_query) }}"
|
||||||
|
|
||||||
|
- name: uninstall package
|
||||||
|
when: kitty_install_required and kitty.stat.exists
|
||||||
|
become: true
|
||||||
|
command:
|
||||||
|
cmd: 'stow --delete --target /usr/local .'
|
||||||
|
chdir: '{{kitty_package_dir}}'
|
||||||
|
|
||||||
|
- name: remove outdated package
|
||||||
|
when: kitty_install_required and kitty.stat.exists
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: '{{kitty_package_dir}}'
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
kitty_package_archive: '{{kitty_package_dir}}/{{kitty_asset.name}}'
|
||||||
|
|
||||||
|
- name: create package directory
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: '{{kitty_package_dir}}'
|
||||||
|
|
||||||
|
- name: download package
|
||||||
|
when: kitty_install_required
|
||||||
|
become: true
|
||||||
|
get_url:
|
||||||
|
url: '{{kitty_asset.browser_download_url}}'
|
||||||
|
dest: '{{kitty_package_archive}}'
|
||||||
|
environment: '{{proxy_environment}}'
|
||||||
|
|
||||||
|
- name: decompress package
|
||||||
|
when: kitty_install_required
|
||||||
|
become: true
|
||||||
|
unarchive:
|
||||||
|
src: '{{kitty_package_archive}}'
|
||||||
|
dest: '{{kitty_package_dir}}'
|
||||||
|
owner: root
|
||||||
|
group: staff
|
||||||
|
|
||||||
|
- name: remove package archive
|
||||||
|
when: kitty_install_required
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: '{{kitty_package_archive}}'
|
||||||
|
|
||||||
|
- name: install package
|
||||||
|
when: kitty_install_required
|
||||||
|
become: true
|
||||||
|
command:
|
||||||
|
cmd: 'stow --no-folding --target /usr/local .'
|
||||||
|
chdir: '{{kitty_package_dir}}'
|
||||||
|
@ -9,6 +9,28 @@
|
|||||||
name: neovim
|
name: neovim
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
old_package_dir: '/usr/local/lib/nvim/nvim-linux64'
|
||||||
|
|
||||||
|
- name: check if old package directory exists
|
||||||
|
stat:
|
||||||
|
path: '{{old_package_dir}}'
|
||||||
|
register: old_package
|
||||||
|
|
||||||
|
- name: uninstall package from old directory
|
||||||
|
when: old_package.stat.exists
|
||||||
|
become: true
|
||||||
|
command:
|
||||||
|
cmd: 'stow --delete --target /usr/local .'
|
||||||
|
chdir: '{{old_package_dir}}'
|
||||||
|
|
||||||
|
- name: remove old package directory
|
||||||
|
when: old_package.stat.exists
|
||||||
|
become: true
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: '{{old_package_dir}}'
|
||||||
|
|
||||||
- name: install gnu stow for managing tar.gz package
|
- name: install gnu stow for managing tar.gz package
|
||||||
become: true
|
become: true
|
||||||
apt:
|
apt:
|
||||||
@ -47,7 +69,7 @@
|
|||||||
'{{installed_version is not defined or
|
'{{installed_version is not defined or
|
||||||
installed_version != latest.json.tag_name}}'
|
installed_version != latest.json.tag_name}}'
|
||||||
asset_query: '[?contains(name, `nvim-linux64.tar.gz`)]'
|
asset_query: '[?contains(name, `nvim-linux64.tar.gz`)]'
|
||||||
package_dir: '/usr/local/lib/nvim'
|
package_dir: '/usr/local/stow/nvim'
|
||||||
- set_fact:
|
- set_fact:
|
||||||
uninstall_required: '{{nvim.stat.exists and install_required}}'
|
uninstall_required: '{{nvim.stat.exists and install_required}}'
|
||||||
asset: '{{latest.json.assets | json_query(asset_query)}}'
|
asset: '{{latest.json.assets | json_query(asset_query)}}'
|
||||||
@ -108,7 +130,7 @@
|
|||||||
when: install_required
|
when: install_required
|
||||||
become: true
|
become: true
|
||||||
command:
|
command:
|
||||||
cmd: 'stow --target /usr/local .'
|
cmd: 'stow --no-folding --target /usr/local .'
|
||||||
chdir: '{{package_dir}}/nvim-linux64'
|
chdir: '{{package_dir}}/nvim-linux64'
|
||||||
|
|
||||||
- include_tasks: Unix.yaml
|
- include_tasks: Unix.yaml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user