ansible_role_install_dotnet
Ansible Role: Install .NET
Install .NET for Linux and Windows.
Work on
Ansible Galaxy style
platforms:
- name: Fedora
versions:
- 33
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- cosmic
- disco
- eoan
- focal
- name: Debian
version:
- jessie
- stretch
- buster
# https://github.com/ansible/galaxy/issues/2072
- name: EL
versions:
- 7
- 8
- name: opensuse
vesrion:
- tumbleweed
- 15.2
- name: Windows
version:
- 2008x64 (7 64bit)
- 2019 (10 64bit)
Requirements
[min_ansible_version: 2.8]
Role Variables
#--- Release section ---#
# https://dotnet.microsoft.com/download/dotnet-core
# https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
dotnet_support_phase: active
# dotnet_support_phase: lts
# dotnet_support_phase: current
# dotnet_support_phase: preview
# # dotnet_support_phase: eol
dotnet_default_component: runtime
# dotnet_default_component: sdk
# dotnet_default_component: hosting
# dotnet_default_component: aspnetcore-runtime
# TODO
# dotnet_default_component: aspnetcore-targeting-pack-5.0
# dotnet_current_releases_json: https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/5.0/releases.json
# dotnet_current_channel_version: 5.0
# TODO.
# dotnet_current_release: 5.0.3
# dotnet_current_runtime: 5.0.3
# dotnet_current_sdk: 5.0.200
# dotnet_current_aspnetcore_runtime:
# For install custom version for Linux. sudo apt-get install dotnet-runtime-5.0=5.0.3-1
# dotnet_current_version: 5.0.3-1
# If you have a copy on your local network
# dotnet_runtime_or_sdk_win_x64_exe_url: http://10.10.10.10/soft/dotnet/dotnet-{{ dotnet_default_component }}-latest-win-amd64.exe
#--- Method install section ---#
dotnet_method_install: package-manager
# https://en.wikipedia.org/wiki/Snappy_(package_manager)
# https://snapcraft.io/search?q=dotnetcore
# dotnet_method_install: snap
#--- Urls section ---#
# https://docs.microsoft.com/en-us/dotnet/core/install/linux
dotnet_releases_index_json_url: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
#--- Repo section ---#
dotnet_repo_deb_key: https://packages.microsoft.com/keys/microsoft.asc
dotnet_repo_rpm_key: https://packages.microsoft.com/keys/microsoft.asc
# If you *NOT* use apt-cacher-ng or other caching proxy - select "https".
http_or_https: http
# http_or_https: https
#--- Apt repo section ---#
# https://repolib.readthedocs.io/en/latest/deb822-format.html
dotnet_apt_repo_architectures:
- amd64
- arm64
- armhf
dotnet_apt_repo_components:
- main
dotnet_apt_repo_types:
- deb
# - deb-src
dotnet_apt_repo_uris:
- "{{ http_or_https }}://packages.microsoft.com/{{ ansible_lsb.id | lower }}/{{ ansible_distribution_version }}/prod"
dotnet_apt_repo_x_repolib_name: Official Microsoft repository
dotnet_apt_repo_path_to_sources: /etc/apt/sources.list.d/microsoft.sources
Dependencies
If you want deploy to Windows 7
Download and install Windows Management Framework 5.1
HowTo
How to install role
Over ansible-galaxy
:
ansible-galaxy install don_rumata.ansible_role_install_dotnet
Over bash+git
:
mkdir -p "$HOME/.ansible/roles"
cd "$HOME/.ansible/roles"
git clone https://github.com/don-rumata/ansible-role-install-dotnet don_rumata.ansible_role_install_dotnet
Quick config WinRM for Windows
https://ru.stackoverflow.com/a/949971/191416
Example Playbooks
I
Install latest current dotnet on Windows or Linux over package manager of you distro:
install-dotnet.yml
:
- name: Install dotnet
hosts: all
strategy: free
serial:
- "100%"
roles:
- don_rumata.ansible_role_install_dotnet
tasks:
II
Install version 2.1
:
install-dotnet.yml
:
- name: Install dotnet
hosts: all
strategy: free
serial:
- "100%"
roles:
- role: ansible-role-install-dotnet
dotnet_current_channel_version: 2.1
tasks:
III
Install different versions for different hosts:
install-dotnet.yml
:
- name: Install dotnet
hosts: all
strategy: free
serial:
- "100%"
roles:
- role: ansible-role-install-dotnet
tasks:
dotnet-inventory.ini
:
[linux-hosts]
debian-test-01.local
ubuntu-test-01.local dotnet_method_install=snap
centos-7-test-01.local ansible_python_interpreter=/usr/bin/python2
centos-8-test-01.local
opensuse-leap-test-01.local dotnet_default_component=sdk
opensuse-tumbleweed-test-01.local
fedora-33-test-01.local dotnet_support_phase=lts
[windows-hosts]
10.10.10.20
10.10.10.21
10.10.10.22
10.10.10.23
win7-64 dotnet_runtime_or_sdk_win_x64_exe_url=\\10.10.10.10\soft\dotnet\dotnet-{{ dotnet_default_component }}-latest-win-amd64.exe dotnet_default_component=hosting
win10-64 dotnet_runtime_or_sdk_win_x64_exe_url=http://10.10.10.10/soft/dotnet/dotnet-{{ dotnet_default_component }}-latest-win-amd64.exe dotnet_support_phase=preview dotnet_default_component=sdk
ansible-playbook -i ./dotnet-inventory.ini ./install-dotnet.yml
License
Apache License, Version 2.0
Author Information
TODO
- Add tests.
About
Install dotnet for Linux and Windows
Install
ansible-galaxy install don-rumata/ansible-role-install-dotnet
License
apache-2.0
Downloads
129
Owner
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.