don_rumata.ansible_role_install_nodejs

Rola Ansible: Instalacja NodeJS

Licencja Ansible Galaxy CircleCI

Instalacja nodejs dla Linux i Windows.

Platformy

Styl Ansible Galaxy

  platformy:
    - nazwa: Fedora
      wersje:
        - 33
    - nazwa: Ubuntu
      wersje:
        - trusty
        - xenial
        - bionic
        - cosmic
        - disco
        - eoan
        - focal
    - nazwa: Debian
      wersje:
        - jessie
        - stretch
        - buster
        - sid
    # https://github.com/ansible/galaxy/issues/2072
    - nazwa: EL
      wersje:
        - 7
        - 8
    - nazwa: opensuse
      wersje:
        - tumbleweed
        - 15.2
    - nazwa: Windows
      wersje:
        - 2008x64 (7 64bit)
        - 2019 (10 64bit)

Wymagania

min_ansible_version: 2.8

Zmienne roli

#--- Metoda instalacji NodeJS ---#
nodejs_method_install: package-manager
# nodejs_method_install: snap

#--- Sekcja wersji ---#
nodejs_major_version: lts
# nodejs_major_version: current
# nodejs_major_version: 14
# nodejs_major_version: 12
# nodejs_major_version: 10

#--- Sekcja proxy ---#
nodejs_use_over_proxy: false
# nodejs_use_over_proxy: true
nodejs_proxy_host: proxy.example.com
nodejs_proxy_port: 3128
nodejs_proxy_string: http://{{ nodejs_proxy_host }}:{{ nodejs_proxy_port }}

#--- Sekcja repozytoriów ---#
nodejs_index_json_url: https://nodejs.org/dist/index.json
nodejs_repo_deb_key: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
nodejs_repo_rpm_key: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL

# Jeśli masz kopię w swojej lokalnej sieci
# nodejs_direct_url_win: http://10.10.10.10/soft/nodejs/node-latest-amd64.msi
# nodejs_direct_url_win: \\10.10.10.10\soft\nodejs\node-latest-amd64.msi

# Jeśli *NIE* używasz apt-cacher-ng lub innego proxy cache - wybierz "https".
http_or_https: http
# http_or_https: https

Zależności

Jeśli chcesz instalować na Windows 7

Pobierz i zainstaluj Windows Management Framework 5.1

Jak to zrobić

Jak zainstalować rolę

Przez ansible-galaxy:

ansible-galaxy install don_rumata.ansible_role_install_nodejs

Przez bash+git:

mkdir -p "$HOME/.ansible/roles"
cd "$HOME/.ansible/roles
git clone https://github.com/don-rumata/ansible-role-install-nodejs don_rumata.ansible_role_install_nodejs

Szybka konfiguracja WinRM dla Windows

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

Przykładowe playbooki

I

Zainstaluj najnowszego LTS nodejs na Windows lub Linux przez menedżer pakietów twojej dystrybucji:

install-nodejs.yml:

- nazwa: Instalacja NodeJS
  hosty: all
  strategia: free
  serial:
    - "100%"
  role:
    - don_rumata.ansible_role_install_nodejs
  zadania:

II

Zainstaluj wersję 12:

install-nodejs.yml:

- nazwa: Instalacja NodeJS
  hosty: all
  strategia: free
  serial:
    - "100%"
  role:
    - rola: ansible-role-install-nodejs
      nodejs_major_version: 12
  zadania:

III

Zainstaluj różne wersje dla różnych hostów:

install-nodejs.yml:

- nazwa: Instalacja NodeJS
  hosty: all
  strategia: free
  serial:
    - "100%"
  role:
    - rola: ansible-role-install-nodejs
  zadania:

nodejs-inventory.ini:

[l4inux-hosts]
debian-test-01.local
ubuntu-test-01.local nodejs_method_install=snap
centos-7-test-01.local ansible_python_interpreter=/usr/bin/python2
centos-8-test-01.local
opensuse-leap-test-01.local nodejs_major_version=12
opensuse-tumbleweed-test-01.local
fedora-33-test-01.local nodejs_use_over_proxy=true

[windows-hosts]
10.10.10.20
10.10.10.21
10.10.10.22
10.10.10.23
win7-64 nodejs_direct_url_win=http://10.10.10.10/soft/nodejs/7/node-v12.19.0-x64.msi
win10-64 nodejs_direct_url_win=http://10.10.10.10/soft/nodejs/node-latest-amd64-{{ nodejs_major_version }}.msi
ansible-playbook -i ./nodejs-inventory.ini ./install-nodejs.yml

Licencja

Licencja Apache, Wersja 2.0

Informacje o autorze

don Rumata

TODO

  • Dodać testy.
  • Dodać wsparcie instalacji dla konkretnej wersji pełnej jako 12.18.2.
Zainstaluj
ansible-galaxy install don_rumata.ansible_role_install_nodejs
Licencja
apache-2.0
Pobrania
82
Właściciel
Здесь все бесполезно. Знаний не хватает, а золото теряет цену, потому что опаздывает.