Install nodejs for Linux and Windows.
platforms:
- name: Fedora
versions:
- 33
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- cosmic
- disco
- eoan
- focal
- name: Debian
version:
- jessie
- stretch
- buster
- sid
# https://github.com/ansible/galaxy/issues/2072
- name: EL
versions:
- 7
- 8
- name: opensuse
vesrion:
- tumbleweed
- 15.2
- name: Windows
version:
- 2008x64 (7 64bit)
- 2019 (10 64bit)
#--- NodeJS method install ---#
nodejs_method_install: package-manager
# nodejs_method_install: snap
#--- Version section ---#
nodejs_major_version: lts
# nodejs_major_version: current
# nodejs_major_version: 14
# nodejs_major_version: 12
# nodejs_major_version: 10
#--- Proxy section ---#
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 }}
#--- Repo section ---#
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
# If you have a copy on your local network
# 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
# If you *NOT* use apt-cacher-ng or other caching proxy - select "https".
http_or_https: http
# http_or_https: https
Download and install Windows Management Framework 5.1
Over ansible-galaxy
:
ansible-galaxy install don_rumata.ansible_role_install_nodejs
Over 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
https://ru.stackoverflow.com/a/949971/191416
Install latest LTS nodejs on Windows or Linux over package manager of you distro:
install-nodejs.yml
:
- name: Install NodeJS
hosts: all
strategy: free
serial:
- "100%"
roles:
- don_rumata.ansible_role_install_nodejs
tasks:
Install version 12
:
install-nodejs.yml
:
- name: Install NodeJS
hosts: all
strategy: free
serial:
- "100%"
roles:
- role: ansible-role-install-nodejs
nodejs_major_version: 12
tasks:
Install different versions for different hosts:
install-nodejs.yml
:
- name: Install NodeJS
hosts: all
strategy: free
serial:
- "100%"
roles:
- role: ansible-role-install-nodejs
tasks:
nodejs-inventory.ini
:
[linux-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
Apache License, Version 2.0
- Add tests.
- Add installation support for a specific full version as
12.18.2
.