don_rumata.ansible_role_install_dotnet
Rôle Ansible : Installer .NET
Installer .NET pour Linux et Windows.
Fonctionne sur
Style Ansible Galaxy
  plateformes:
    - nom: Fedora
      versions:
        - 33
    - nom: Ubuntu
      versions:
        - trusty
        - xenial
        - bionic
        - cosmic
        - disco
        - eoan
        - focal
    - nom: Debian
      version:
        - jessie
        - stretch
        - buster
    # https://github.com/ansible/galaxy/issues/2072
    - nom: EL
      versions:
        - 7
        - 8
    - nom: opensuse
      version:
        - tumbleweed
        - 15.2
    - nom: Windows
      version:
        - 2008x64 (7 64bit)
        - 2019 (10 64bit)
Exigences
[min_ansible_version: 2.8]
Variables du rôle
#--- Section de version ---#
# https://dotnet.microsoft.com/download/dotnet-core
dotnet_support_phase: actif
# dotnet_support_phase: lts
# dotnet_support_phase: actuel
# dotnet_support_phase: avant-première
# dotnet_support_phase: fin_de_vie
dotnet_default_component: runtime
# dotnet_default_component: sdk
# dotnet_default_component: hébergement
# dotnet_default_component: aspnetcore-runtime
# TODO
# dotnet_current_release: 5.0.3
# Pour installer une version personnalisée pour Linux. sudo apt-get install dotnet-runtime-5.0=5.0.3-1
# dotnet_current_version: 5.0.3-1
# Si vous avez une copie sur votre réseau 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éthode d'installation ---#
dotnet_method_install: gestionnaire-de-paquet
#--- Section des URLs ---#
dotnet_releases_index_json_url: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
#--- Section du dépôt ---#
dotnet_repo_deb_key: https://packages.microsoft.com/keys/microsoft.asc
dotnet_repo_rpm_key: https://packages.microsoft.com/keys/microsoft.asc
# Si vous *NE* utilisez pas apt-cacher-ng ou un autre proxy de mise en cache - sélectionnez "https".
http_or_https: http
# http_or_https: https
#--- Section du dépôt 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: Dépôt officiel de Microsoft
dotnet_apt_repo_path_to_sources: /etc/apt/sources.list.d/microsoft.sources
Dépendances
Si vous voulez déployer sur Windows 7
Téléchargez et installez Windows Management Framework 5.1
Comment faire
Comment installer le rôle
Via ansible-galaxy :
ansible-galaxy install don_rumata.ansible_role_install_dotnet
Via 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
Configuration rapide de WinRM pour Windows
https://ru.stackoverflow.com/a/949971/191416
Exemples de Playbooks
I
Installer la dernière version de dotnet sur Windows ou Linux via le gestionnaire de paquets de votre distribution :
install-dotnet.yml :
- nom : Installer dotnet
  hôtes : tous
  stratégie : libre
  série :
    - "100%"
  rôles :
    - don_rumata.ansible_role_install_dotnet
  tâches :
II
Installer la version 2.1 :
install-dotnet.yml :
- nom : Installer dotnet
  hôtes : tous
  stratégie : libre
  série :
    - "100%"
  rôles :
    - rôle : ansible-role-install-dotnet
      dotnet_current_channel_version: 2.1
  tâches :
III
Installer différentes versions pour différents hôtes :
install-dotnet.yml :
- nom : Installer dotnet
  hôtes : tous
  stratégie : libre
  série :
    - "100%"
  rôles :
    - rôle : ansible-role-install-dotnet
  tâches :
dotnet-inventory.ini :
[hôtes-linux]
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
[hôtes-windows]
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
Licence
Licence Apache, version 2.0
Informations sur l'auteur
À faire
- Ajouter des tests.
À propos du projet
 Install dotnet for Linux and Windows
Installer
 ansible-galaxy install don_rumata.ansible_role_install_dotnetLicence
 
            apache-2.0
          
Téléchargements
 
            151
          
Propriétaire
 Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.
