Split tasks, try to install kitty-terminfo

This commit is contained in:
Sven Velt 2021-03-31 09:35:31 +02:00
parent 7c2a9ff252
commit 976a12bd40
2 changed files with 55 additions and 42 deletions

View file

@ -1,20 +1,4 @@
--- ---
- name: Create tempdir
tempfile:
state: directory
register: kitty_tempdir
delegate_to: localhost
run_once: True
- name: Download actuel kitty terminfo
get_url:
url: "https://github.com/kovidgoyal/kitty/blob/master/terminfo/x/xterm-kitty?raw=true"
dest: "{{ kitty_tempdir.path }}/xterm-kitty"
delegate_to: localhost
run_once: True
- name: Look for already installed kitty - name: Look for already installed kitty
shell: "which kitty" shell: "which kitty"
register: kitty_installed register: kitty_installed
@ -22,34 +6,17 @@
changed_when: False changed_when: False
- name: "(Block) Install terminfo dir and file" - name: 'Try to install "kitty-terminfo"'
block: package:
name: kitty-terminfo
- name: Create terminfo dir state: latest
file: ignore_errors: yes
path: /usr/share/terminfo/x/ register: kitty_terminfo_installed
state: directory
owner: root
group: root
mode: "0755"
force: False
- name: Copy terminfo
copy:
src: "{{ kitty_tempdir.path }}/xterm-kitty"
dest: "/usr/share/terminfo/x/xterm-kitty"
owner: root
group: root
mode: 0644
when: kitty_installed is failed when: kitty_installed is failed
- name: Delete tempdir - name: "If no kitty(-terminfo) available, install manually"
file: include_tasks: manual.yml
path: "{{ kitty_tempdir.path }}" when: kitty_terminfo_installed is failed and kitty_terminfo_installed is defined and kitty_terminfo_installed is failed
state: absent
delegate_to: localhost
run_once: True

46
tasks/manual.yml Normal file
View file

@ -0,0 +1,46 @@
---
- name: Create tempdir
tempfile:
state: directory
register: kitty_tempdir
delegate_to: localhost
run_once: True
- name: Download actuel kitty terminfo
get_url:
url: "https://github.com/kovidgoyal/kitty/blob/master/terminfo/x/xterm-kitty?raw=true"
dest: "{{ kitty_tempdir.path }}/xterm-kitty"
delegate_to: localhost
run_once: True
- name: "(Block) Install terminfo dir and file"
block:
- name: Create terminfo dir
file:
path: /usr/share/terminfo/x/
state: directory
owner: root
group: root
mode: "0755"
force: False
- name: Copy terminfo
copy:
src: "{{ kitty_tempdir.path }}/xterm-kitty"
dest: "/usr/share/terminfo/x/xterm-kitty"
owner: root
group: root
mode: 0644
- name: Delete tempdir
file:
path: "{{ kitty_tempdir.path }}"
state: absent
delegate_to: localhost
run_once: True