Dot_Files/tasks/install-dotnet.yml

34 lines
889 B
YAML
Raw Normal View History

2022-08-01 17:02:04 -05:00
---
- 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 }}"
2022-08-01 17:03:13 -05:00
chdir: "{{ dotnet_work_dir }}"
2022-08-01 17:02:04 -05:00
changed_when: true