don_rumata.ansible_role_install_dotnet

Ansible Role: Install .NET

License Ansible Galaxy Ansible Role downloads

This role installs .NET on Linux and Windows.

Supported Platforms

Ansible Galaxy Format

  platforms:
    - name: Fedora
      versions:
        - 33
    - name: Ubuntu
      versions:
        - trusty
        - xenial
        - bionic
        - cosmic
        - disco
        - eoan
        - focal
    - name: Debian
      version:
        - jessie
        - stretch
        - buster
    - name: EL (Enterprise Linux)
      versions:
        - 7
        - 8
    - name: openSUSE
      versions:
        - tumbleweed
        - 15.2
    - name: Windows
      version:
        - 2008x64 (7 64-bit)
        - 2019 (10 64-bit)

Requirements

Minimum Ansible version: 2.8

Role Variables

#--- .NET Release Section ---#
dotnet_support_phase: active
# Options include: lts, current, preview, eol

dotnet_default_component: runtime
# Options include: sdk, hosting, aspnetcore-runtime

# To install a custom version for Linux: sudo apt-get install dotnet-runtime-5.0=5.0.3-1
# dotnet_current_version: 5.0.3-1

# To install from a local network
# dotnet_runtime_or_sdk_win_x64_exe_url: http://your-local-url/dotnet-{{ dotnet_default_component }}-latest-win-amd64.exe

#--- Installation Method Section ---#
dotnet_method_install: package-manager
# Alternative: dotnet_method_install: snap

#--- URLs for Releases ---#
dotnet_releases_index_json_url: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json

#--- Repository Section ---#
dotnet_repo_deb_key: https://packages.microsoft.com/keys/microsoft.asc
dotnet_repo_rpm_key: https://packages.microsoft.com/keys/microsoft.asc

http_or_https: http
# Change to https if not using a caching proxy

#--- Apt Repository Section ---#
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: Official Microsoft repository
dotnet_apt_repo_path_to_sources: /etc/apt/sources.list.d/microsoft.sources

Dependencies

If you want to deploy to Windows 7, download and install Windows Management Framework 5.1.

How To

Installing the Role

Using ansible-galaxy:

ansible-galaxy install don_rumata.ansible_role_install_dotnet

Using bash and 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 WinRM Configuration for Windows

Refer to this guide: https://ru.stackoverflow.com/a/949971/191416

Example Playbooks

I

To install the latest .NET on Windows or Linux using your distribution's package manager:

install-dotnet.yml:

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

II

To 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

To 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

Then run the playbook:

ansible-playbook -i ./dotnet-inventory.ini ./install-dotnet.yml

License

Apache License, Version 2.0

Author Information

don Rumata

TODO

  • Add tests.
Installa
ansible-galaxy install don_rumata.ansible_role_install_dotnet
Licenza
apache-2.0
Download
141
Proprietario
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.