feat: add dotnet installer

This commit is contained in:
Price Hiller 2022-08-01 17:02:04 -05:00
parent d1d59a1743
commit b32961ad75
2 changed files with 35 additions and 0 deletions

View File

@ -36,3 +36,6 @@
- name: Install direnv
ansible.builtin.import_tasks: install-direnv.yml
- name: Install dotnet
ansible.builtin.import_tasks: install-dotnet.yml

32
tasks/install-dotnet.yml Normal file
View File

@ -0,0 +1,32 @@
---
- name: Set dotnet install path if not set
ansible.builtin.set_fact:
dotnet_install_path: "{{ dotnet_install_path | default(xdg_data_home + '/dotnet') }}"
- name: Check if dotnet is installed
ansible.builtin.stat:
path: "{{ dotnet_install_path }}"
register: dotnet_installed
changed_when: false
- name: Create temporary working directory
ansible.builtin.tempfile:
state: directory
register: dotnet_work_dir
when: not dotnet_installed.stat.exists
- name: Download dotnet installer
ansible.builtin.get_url:
url: https://dot.net/v1/dotnet-install.sh
dest: "{{ dotnet_work_dir }}/install.sh"
mode: 0744
when: not dotnet_installed.stat.exists
- name: Run dotnet installer
ansible.builtin.command:
argv:
- bash
- install.sh
- -i
- "{{ dotnet_install_path }}"
changed_when: true