Installing NodeJS LTS for Ansible
Clash Royale CLAN TAG#URR8PPP
Installing NodeJS LTS for Ansible
I'm looking for an appropriate Ansible Role or Ansible YAML file for installing NodeJS LTS on a Ubuntu 16.04.3 xenial system. I tried more than 10 Ansible roles from Galaxy but didn't find any of them working (throws error such as potentially dangerous to add this PPA etc.
.
potentially dangerous to add this PPA etc.
Can anyone provide any Ansible playbook or suggest me a role to install NodeJS LTS on Ubuntu 16.04?
2 Answers
2
Here is the working example:
---
- hosts: all
gather_facts: yes
become: yes
vars:
NODEJS_VERSION: "8"
ansible_distribution_release: "xenial" #trusty
tasks:
- name: Install the gpg key for nodejs LTS
apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
state: present
- name: Install the nodejs LTS repos
apt_repository:
repo: "deb https://deb.nodesource.com/node_ NODEJS_VERSION .x ansible_distribution_release main"
state: present
update_cache: yes
- name: Install the nodejs
apt:
name: nodejs
state: present
Hope it will help you
it somehow works but shows the error
"msg": "unsupported parameter for module: filename"
. Any idea?– Janshair Khan
Aug 24 '17 at 4:38
"msg": "unsupported parameter for module: filename"
try now, which version of ansible are you using?
– Arbab Nazar
Aug 24 '17 at 5:38
I'm using
ansible 2.0.0.2
– Janshair Khan
Aug 24 '17 at 5:52
ansible 2.0.0.2
Thanks, I upgraded ansible to
2.3.2.0
and it worked.– Janshair Khan
Aug 24 '17 at 6:27
2.3.2.0
what are the possible values for the var
ansible_distribution_release
?– user1623521
Jan 22 at 4:24
ansible_distribution_release
You can use:
ansible-galaxy install nodesource.node
ansible-galaxy install nodesource.node
and then on your playbook, add
roles:
- nodesource.node
roles:
- nodesource.node
For all who puts "-", please describe why. I don't see any problems with this suggestion. It does not work or what?
– Sergey Yarotskiy
Jul 23 at 18:01
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Do you know what are the steps to install it without Ansible? If so, why don't you create your own role?
– JorgeeFG
Aug 23 '17 at 13:19