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

54 lines
1.3 KiB
YAML

---
- name: Install direnv for Arch
become: true
community.general.pacman:
name:
- direnv
state: present
when: ansible_facts.distribution == 'Archlinux'
- name: Install direnv for Debian based systems
become: true
ansible.builtin.apt:
name:
- direnv
state: present
when: ansible_facts.os_family == 'Debian'
- name: Install direnv for MacOS
community.general.homebrew:
name:
- direnv
state: present
when: ansible_facts.distribution == 'MacOSX'
- name: Check if direnv installed
ansible.builtin.stat:
path: "{{ xdg_bin_home }}/direnv"
register: direnv_installed
changed_when: false
- name: Install direnv for RedHat based systems
when:
- ansible_facts.os_family == 'RedHat'
- not direnv_installed.stat.exists
block:
- name: Create direnv working dir
ansible.builtin.tempfile:
state: directory
register: direnv_work_dir
- name: Download direnv installer script
ansible.builtin.get_url:
url: https://direnv.net/install.sh
dest: "{{ direnv_work_dir.path }}/install.sh"
mode: "0744"
- name: Install direnv
tags:
- skip_ansible_lint
ansible.builtin.command: "bash {{ direnv_work_dir.path }}/install.sh"
environment:
bin_path: "{{ xdg_bin_home }}"