2022-08-01 16:42:48 -05:00
|
|
|
---
|
2022-08-03 01:35:21 -05:00
|
|
|
- name: Install direnv for Arch
|
2022-08-05 15:39:49 -05:00
|
|
|
become: true
|
2022-08-03 01:35:21 -05:00
|
|
|
community.general.pacman:
|
|
|
|
name:
|
|
|
|
- direnv
|
|
|
|
state: present
|
|
|
|
when: ansible_facts.distribution == 'Archlinux'
|
2022-08-01 16:42:48 -05:00
|
|
|
|
2022-08-03 01:35:21 -05:00
|
|
|
- name: Install direnv for Debian based systems
|
|
|
|
become: true
|
|
|
|
ansible.builtin.apt:
|
|
|
|
name:
|
|
|
|
- direnv
|
|
|
|
state: present
|
|
|
|
when: ansible_facts.os_family == 'Debian'
|
2022-08-01 16:42:48 -05:00
|
|
|
|
2022-08-03 01:35:21 -05:00
|
|
|
- name: Install direnv for MacOS
|
|
|
|
community.general.homebrew:
|
|
|
|
name:
|
|
|
|
- direnv
|
|
|
|
state: present
|
|
|
|
when: ansible_facts.distribution == 'MacOSX'
|
2022-08-03 01:36:16 -05:00
|
|
|
|
2023-04-02 22:12:02 -05:00
|
|
|
- name: Check if direnv installed
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: "{{ xdg_bin_home }}/direnv"
|
|
|
|
register: direnv_installed
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
|
2022-08-03 01:36:16 -05:00
|
|
|
- name: Install direnv for RedHat based systems
|
2023-04-02 22:12:02 -05:00
|
|
|
when:
|
|
|
|
- ansible_facts.os_family == 'RedHat'
|
|
|
|
- not direnv_installed.stat.exists
|
2022-08-03 01:36:16 -05:00
|
|
|
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"
|
2023-04-02 22:12:02 -05:00
|
|
|
mode: "0744"
|
2022-08-03 01:36:16 -05:00
|
|
|
|
|
|
|
- name: Install direnv
|
2023-04-02 22:12:02 -05:00
|
|
|
tags:
|
|
|
|
- skip_ansible_lint
|
2022-08-03 01:36:16 -05:00
|
|
|
ansible.builtin.command: "bash {{ direnv_work_dir.path }}/install.sh"
|
|
|
|
environment:
|
|
|
|
bin_path: "{{ xdg_bin_home }}"
|