36 lines
1.0 KiB
YAML
36 lines
1.0 KiB
YAML
---
|
|
- 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.path }}/install.sh"
|
|
mode: "0744"
|
|
when: not dotnet_installed.stat.exists
|
|
|
|
- name: Run dotnet installer
|
|
ansible.builtin.command:
|
|
cmd: ./install.sh --channel "{{ dotnet_release_channel }}" --version latest -i "{{ dotnet_install_path }}"
|
|
chdir: "{{ dotnet_work_dir.path }}"
|
|
changed_when: true
|
|
when: not dotnet_installed.stat.exists
|
|
loop_control:
|
|
loop_var: dotnet_release_channel
|
|
loop:
|
|
- LTS
|
|
- STS
|