don_rumata.ansible_role_install_dotnet

Rol de Ansible: Instalar .NET

Licencia Ansible Galaxy Descargas del rol Ansible

Instala .NET para Linux y Windows.

Plataformas compatibles

Estilo de Ansible Galaxy

  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
      version:
        - tumbleweed
        - 15.2
    - name: Windows
      version:
        - 2008x64 (7 64bit)
        - 2019 (10 64bit)

Requisitos

[min_ansible_version: 2.8]

Variables del rol

#--- Sección de lanzamiento ---#
# https://dotnet.microsoft.com/download/dotnet-core

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

# Para instalar una versión personalizada en Linux. sudo apt-get install dotnet-runtime-5.0=5.0.3-1
# dotnet_current_version: 5.0.3-1

# Si tienes una copia en tu red local
# dotnet_runtime_or_sdk_win_x64_exe_url: http://10.10.10.10/soft/dotnet/dotnet-{{ dotnet_default_component }}-latest-win-amd64.exe

#--- Método de instalación ---#

dotnet_method_install: package-manager

#--- Sección de URLs ---#
dotnet_releases_index_json_url: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json

#--- Sección de repositorios ---#

dotnet_repo_deb_key: https://packages.microsoft.com/keys/microsoft.asc
dotnet_repo_rpm_key: https://packages.microsoft.com/keys/microsoft.asc

# Selecciona "http" o "https" según lo que uses.
http_or_https: http
# http_or_https: https

#--- Sección de repositorios APT ---#

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: Repositorio oficial de Microsoft
dotnet_apt_repo_path_to_sources: /etc/apt/sources.list.d/microsoft.sources

Dependencias

Si quieres desplegar en Windows 7

Descarga e instala Windows Management Framework 5.1

Cómo hacerlo

Cómo instalar el rol

Con ansible-galaxy:

ansible-galaxy install don_rumata.ansible_role_install_dotnet

Con 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

Configuración rápida de WinRM para Windows

https://ru.stackoverflow.com/a/949971/191416

Ejemplos de Playbooks

I

Instala la última versión de dotnet en Windows o Linux usando el gestor de paquetes de tu distribución:

install-dotnet.yml:

- name: Install dotnet
  hosts: all
  strategy: free
  serial:
    - "100%"
  roles:
    - don_rumata.ansible_role_install_dotnet
  tasks:

II

Instala la versión 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

Instala diferentes versiones para diferentes 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

Licencia

Licencia Apache, Versión 2.0

Información del autor

don Rumata

Pendientes

  • Agregar pruebas.
Instalar
ansible-galaxy install don_rumata.ansible_role_install_dotnet
Licencia
apache-2.0
Descargas
141
Propietario
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.