35 lines
940 B
YAML
35 lines
940 B
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:
|
|
argv:
|
|
- bash
|
|
- install.sh
|
|
- -i
|
|
- "{{ dotnet_install_path }}"
|
|
chdir: "{{ dotnet_work_dir.path }}"
|
|
changed_when: true
|
|
when: not dotnet_installed.stat.exists
|