don_rumata.ansible_role_install_dotnet
Ansible角色:安装.NET
为Linux和Windows安装.NET。
支持平台
Ansible Galaxy样式
platforms:
- name: Fedora
versions:
- 33
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- cosmic
- disco
- eoan
- focal
- name: Debian
version:
- jessie
- stretch
- buster
- name: EL
versions:
- 7
- 8
- name: opensuse
version:
- tumbleweed
- 15.2
- name: Windows
version:
- 2008x64 (7 64bit)
- 2019 (10 64bit)
要求
[min_ansible_version: 2.8]
角色变量
#--- 发行部分 ---#
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:
# 如果要在Linux上安装自定义版本。sudo apt-get install dotnet-runtime-5.0=5.0.3-1
# dotnet_current_version: 5.0.3-1
# 如果您在本地网络上有一个副本
# dotnet_runtime_or_sdk_win_x64_exe_url: http://10.10.10.10/soft/dotnet/dotnet-{{ dotnet_default_component }}-latest-win-amd64.exe
#--- 安装方法部分 ---#
dotnet_method_install: package-manager
#--- Urls部分 ---#
dotnet_releases_index_json_url: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
#--- Repo部分 ---#
dotnet_repo_deb_key: https://packages.microsoft.com/keys/microsoft.asc
dotnet_repo_rpm_key: https://packages.microsoft.com/keys/microsoft.asc
# 如果您*不*使用apt-cacher-ng或其他缓存代理 - 选择“https”。
http_or_https: http
# http_or_https: https
#--- Apt repo部分 ---#
dotnet_apt_repo_architectures:
- amd64
- arm64
- armhf
dotnet_apt_repo_components:
- main
dotnet_apt_repo_types:
- deb
dotnet_apt_repo_uris:
- "{{ http_or_https }}://packages.microsoft.com/{{ ansible_lsb.id | lower }}/{{ ansible_distribution_version }}/prod"
dotnet_apt_repo_x_repolib_name: 官方Microsoft软件库
dotnet_apt_repo_path_to_sources: /etc/apt/sources.list.d/microsoft.sources
依赖关系
如果您要部署到Windows 7
下载并安装Windows管理框架5.1
使用方法
如何安装角色
通过ansible-galaxy
:
ansible-galaxy install don_rumata.ansible_role_install_dotnet
通过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
Windows快速配置WinRM
https://ru.stackoverflow.com/a/949971/191416
示例剧本
I
通过您发行版的包管理器在Windows或Linux上安装最新的当前dotnet:
install-dotnet.yml
:
- name: 安装dotnet
hosts: all
strategy: free
serial:
- "100%"
roles:
- don_rumata.ansible_role_install_dotnet
tasks:
II
安装版本2.1
:
install-dotnet.yml
:
- name: 安装dotnet
hosts: all
strategy: free
serial:
- "100%"
roles:
- role: ansible-role-install-dotnet
dotnet_current_channel_version: 2.1
tasks:
III
为不同主机安装不同版本:
install-dotnet.yml
:
- name: 安装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
许可证
Apache许可证,版本2.0
作者信息
待办事项
- 添加测试。
关于项目
Install dotnet for Linux and Windows
安装
ansible-galaxy install don_rumata.ansible_role_install_dotnet
许可证
apache-2.0
下载
141
拥有者
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.