Dot_Files/roles/zsh/tasks/install-autojump.yml

39 lines
1.1 KiB
YAML

---
- name: Check if Autojump Installed
ansible.builtin.command: which autojump
changed_when: false
register: autojump_installed
failed_when: autojump_installed.rc > 1
- name: Set Autojump git destination
ansible.builtin.set_fact:
autojump_git_dest: /tmp/autojump
- name: Get Autojump from Git
ansible.builtin.git:
repo: "{{ autojump_git_repo | default('https://github.com/wting/autojump.git') }}"
dest: "{{ autojump_git_dest }}"
version: "{{ autojump_git_version | default('release-v22.5.3') }}"
force: true
when: autojump_installed.rc != 0
- name: Set Autojump install path if not set
ansible.builtin.set_fact:
auto_jump_install_path: "{{ xdg_data_home + '/autojump' }}"
- name: Install Autojump
ansible.builtin.command:
argv:
- python3
- "{{ autojump_git_dest }}/install.py"
- -d
- "{{ auto_jump_install_path }}"
changed_when: true
when: autojump_installed.rc != 0
- name: Ensure Autojump Uses Python3
ansible.builtin.lineinfile:
path: "{{ auto_jump_install_path }}/bin/autojump"
regexp: "#!.* python$"
line: "#!/usr/bin/env python3"
when: autojump_installed.rc != 0