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
|
2022-08-01 17:05:47 -05:00
|
|
|
dest: "{{ dotnet_work_dir.path }}/install.sh"
|
2022-08-01 17:02:04 -05:00
|
|
|
mode: 0744
|
|
|
|
when: not dotnet_installed.stat.exists
|
|
|
|
|
|
|
|
- name: Run dotnet installer
|
2023-02-20 05:55:22 -06:00
|
|
|
ansible.builtin.command:
|
2023-01-17 14:35:27 -06:00
|
|
|
cmd: ./install.sh --channel "{{ dotnet_release_channel }}" --version latest -i "{{ dotnet_install_path }}"
|
2022-08-01 17:04:01 -05:00
|
|
|
chdir: "{{ dotnet_work_dir.path }}"
|
2022-08-01 17:02:04 -05:00
|
|
|
changed_when: true
|
2022-08-01 17:04:42 -05:00
|
|
|
when: not dotnet_installed.stat.exists
|
2023-01-17 14:35:27 -06:00
|
|
|
loop_control:
|
|
|
|
loop_var: dotnet_release_channel
|
|
|
|
loop:
|
|
|
|
- LTS
|
2023-02-20 05:55:22 -06:00
|
|
|
- STS
|
|
|
|
- 3.1
|
|
|
|
- 6.0
|
|
|
|
- 7.0
|