Giter VIP home page Giter VIP logo

ansible-role-nodejs's Introduction

Ansible Role: Node.js

CI

Installs Node.js on RHEL/CentOS or Debian/Ubuntu.

Requirements

None.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

nodejs_version: "16.x"

The Node.js version to install. "14.x" is the default and works on most supported OSes. Other versions such as "10.x", "14.x", "18.x", etc. should work on the latest versions of Debian/Ubuntu and RHEL/CentOS.

nodejs_install_npm_user: "{{ ansible_ssh_user }}"

The user for whom the npm packages will be installed can be set here, this defaults to ansible_user.

npm_config_prefix: "/usr/local/lib/npm"

The global installation directory. This should be writeable by the nodejs_install_npm_user.

npm_config_unsafe_perm: "false"

Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.

nodejs_npm_global_packages: []

A list of npm packages with a name and (optional) version to be installed globally. For example:

nodejs_npm_global_packages:
  # Install a specific version of a package.
  - name: jslint
    version: 0.9.3
  # Install the latest stable release of a package.
  - name: node-sass
  # This shorthand syntax also works (same as previous example).
  - node-sass
  # Remove a package by setting state to 'absent'.
  - name: node-sass
    state: absent
nodejs_package_json_path: ""

Set a path pointing to a particular package.json (e.g. "/var/www/app/package.json"). This will install all of the defined packages globally using Ansible's npm module.

nodejs_generate_etc_profile: "true"

By default the role will create /etc/profile.d/npm.sh with exported variables (PATH, NPM_CONFIG_PREFIX, NODE_PATH). If you prefer to avoid generating that file (e.g. you want to set the variables yourself for a non-global install), set it to "false".

Dependencies

None.

Example Playbook

- hosts: utility
  vars_files:
    - vars/main.yml
  roles:
    - geerlingguy.nodejs

Inside vars/main.yml:

nodejs_npm_global_packages:
  - name: jslint
  - name: node-sass

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-nodejs's People

Contributors

artursl avatar b00ga avatar fanchthesystem avatar geerlingguy avatar glaszig avatar jwfuller avatar klardotsh avatar lucasrolff avatar majksner avatar mohamedlamineallal avatar oxyc avatar oxzi avatar panickervinod avatar researchiteng avatar starin92 avatar thbar avatar thom8 avatar tsturzl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-nodejs's Issues

Remove `nodejs_forever` default installation

You can install it using nodejs_npm_global_packages instead, it causes lots of little issues. I'm going to do this then bump the major version since some people might rely on it being present.

npm defaults?

npm seems to have some sane defaults like:
The prefix config defaults to the location where node is installed.
or
unsafe-perm Default: false if running as root, true otherwise

How would I use npm's defaults for config options like these?

Remove tasks in main.yml

# TODO: Remove this task after Ansible 2.x npm module bug is fixed. See:
# https://github.com/ansible/ansible-modules-extras/issues/1375

Looks like this was fixed? If so I can throw up a PR that removes the two tasks relating to this.

I removed the tasks locally and both fatals went away:

TASK [geerlingguy.nodejs : Ensure npm global packages are installed.] **********
fatal: [mastervm]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode object' has no attribute 'name'\n\nThe error appears to have been in '/opt/drupalvm/master-env/provisioning/roles/geerlingguy.nodejs/tasks/main.yml': line 28, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# https://github.com/ansible/ansible-modules-extras/issues/1375\n- name: Ensure npm global packages are installed.\n  ^ here\n"}

TASK [geerlingguy.nodejs : Ensure npm global packages are at the latest release.] ***
fatal: [mastervm]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode object' has no attribute 'name'\n\nThe error appears to have been in '/opt/drupalvm/master-env/provisioning/roles/geerlingguy.nodejs/tasks/main.yml': line 40, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Ensure npm global packages are at the latest release.\n  ^ here\n"}

Receiving error adding nodesource apt key.

I'm receiving the following error today on Ubuntu 14.04:

< TASK [geerlingguy.nodejs : Add Nodesource apt key.] >

fatal: [myhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for deb.nodesource.com:443. Make sure your managed systems have a valid CA certificate installed. If the website serving the url uses SNI you need python >= 2.7.9 on your managed machine or you can install the urllib3, pyopenssl, ndg-httpsclient, and pyasn1 python modules to perform SNI verification in python >= 2.6. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible"}

I just built a few dev VMs yesterday, and didn't run into this. I checked the cert on deb.nodesource.com:443 and it appears to be valid, seems it renewed 2 days ago for another year.

Any ideas? Everything is up to date on the ansbile host, and the box is fresh. I even ensured I ran an 'apt-get dist-upgrade', but still encounter the problem after.

Also, I tried just running curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -, and it worked fine. But still fails when I run this playbook.

Ansible_User is undefined when using SSH_CONFIG

Im using the following ssh_config file

Host 192.168.1.1
  User ubuntu
  IdentityFile ~/.ssh/dev.pem
  ControlMaster auto
  ControlPersist 5m

However, the role is returning the following error

TASK [geerlingguy.nodejs : Define nodejs_install_npm_user] *********************
Wednesday 22 February 2017  15:51:13 +1300 (0:00:02.855)       0:00:23.872 ****
fatal: [integration-worker]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible_user' is undefined\n\nThe error appears to have been in '/Users/cristian04/clearpoint/grability-playbooks/galaxy/geerlingguy.nodejs/tasks/main.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Define nodejs_install_npm_user\n  ^ here\n"}

Expected result:
The role should pick the user on the ssh_config file

From ansible/ansible#13982:

ansible_user its not undefined, its null, that is how it is supposed to be. The connection itself will NOT pass a user to ssh, which then uses the current user, this is done to allow the use of .ssh/config when not specifying a user.

RHEL 6 can't install default nodejs version 0.12

Can't use this role to install on RHEL 6 using the default settings of nodejs_version: "0.12". Seems there is no such package as e.g. https://rpm.nodesource.com/pub_0.12/el/6/x86_64/nodesource-release-el6-1.noarch.rpm. (nor i386)

The NodeSource readme seems to show that RHEL 6 is supported, and indeed there are plenty of RPM packages in the nodesource.com directories, but none are named matching what is in setup-RedHat.yml.

sinopia service not found

Hi,

When i run a playbook with sinopia role, i get this error:

TASK [jagregory.sinopia : Start Sinopia] ***************************************
fatal: [10.0.26.112]: FAILED! => {"changed": false, "failed": true, "msg": "systemd could not find the requested service "'sinopia'": "}

and manually:

root@ip-10-0-26-112:/etc/init.d# service sinopia start
Failed to start sinopia.service: Unit sinopia.service failed to load: No such file or directory.

i'm working on a debian 8.3

Issue with permissions on Travis install

Set ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo in .travis.yml

In tests/test.yml:

``
hosts: localhost
remote_user: root

roles:
- geerlingguy.nodejs
- ansible-role-pa11y
``

Oddly, throwing the following error:

TASK [geerlingguy.nodejs : Add NodeSource repositories for Node.js.] *********** changed: [localhost] => (item=deb https://deb.nodesource.com/node_0.10 precise main) failed: [localhost] => (item=deb-src https://deb.nodesource.com/node_0.10 precise main) => {"failed": true, "item": "deb-src https://deb.nodesource.com/node_0.10 precise main", "msg": "[Errno 13] Permission denied: '/etc/apt/sources.list.d/.deb_nodesource_com_node_0_10.list-816YUw'"}

I also tried this within tests/test.yml:

{role: geerlingguy.nodejs, become: yes}

No dice.

missing repo gpg signing keys

https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL

fatal: [xxxx]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"conf_file": null, "disable_gpg_check": false, "disablerepo": null, "enablerepo": null, "exclude": null, "install_repoquery": true, "list": null, "name": ["https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm"], "state": "present", "update_cache": false, "validate_certs": true}, "module_name": "yum"}, "msg": "**Failed to validate the SSL certificate for rpm.nodesource.com:443**. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible"}

Make nodejs_npm_global_packages variable easier to use

Basically, see @oxyc's comment here: geerlingguy/ansible-role-homebrew#33 (comment)

We could allow list items to just be string, and that would be the default filled in for a name parameter if name isn't provided. That way if someone sets up the packages like:

nodejs_npm_global_packages:
  # Install a specific version of a package.
  - name: jslint
    version: 0.9.3
  # Install the latest stable release of a package.
  - node-sass

...it would be perfectly valid!

On debian 7.8 it fails to install

Added the role, ran it, came back with this:

TASK: [geerlingguy.nodejs | Add NodeSource PPA for latest version of Node.js.] ***
failed: [app-01] => {"failed": true}
msg: Invalid repository string: ppa:chris-lea/node.js

Docs on ansible says debian does not like "ppa" repo's.

p.s. used ubuntu now, since it seems the majority of ansible prefers that.

chown failed: failed to look up user

Versions 4.0.1 and above have the following error when installing on Ubuntu 16.04 LTS.

TASK [geerlingguy.nodejs : Create npm global directory] ************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "gid": 0, "group": "root", "mode": "0755", "msg": "chown failed: failed to look up user ", "owner": "root", "path": "/usr/local/lib/npm", "size": 4096, "state": "directory", "uid": 0}

Unable to install gulp as global package

Hi,

I have this configuration :

nodejs_npm_global_packages:
  - name: gulp

But the package won't install. This is the information coming from the playbook in debug mode :

changed: [weenect.dev] => (item={u'name': u'gulp'}) => {"changed": true, "invocation": {"module_args": {"executable": null, "global": true, "ignore_scripts": false, "name": "gulp", "path": null, "production": false, "registry": null, "state": "latest", "version": ""}, "module_name": "npm"}, "item": {"name": "gulp"}}

Do you have any idea ? Is there something I am doing wrong ?

Thanks in advance

Regards

It makes command-not-found misbehave.

apt_repository by default creates files with mode 0420. And here's what it results in:

$ ls -al /etc/apt/sources.list
-rw-r--r-- 1 root root 3248 Jul  7 12:34 /etc/apt/sources.list

$ ls -al /etc/apt/sources.list.d/deb_nodesource_com_node_0_12.list
-r---w---- 1 root root 110 Jul  7 12:34 /etc/apt/sources.list.d/deb_nodesource_com_node_0_12.list

$ /usr/lib/command-not-found asdf
WARNING:root:could not open file '/etc/apt/sources.list.d/deb_nodesource_com_node_0_12.list'

WARNING:root:could not open file '/etc/apt/sources.list.d/oss_binaries_phusionpassenger_com_apt_passenger.list'

No command 'asdf' found, did you mean:
 Command 'asdfg' from package 'aoeui' (universe)
 Command 'sadf' from package 'sysstat' (main)
 Command 'sdf' from package 'sdf' (universe)
asdf: command not found

$ sudo -i

# /usr/lib/command-not-found asdf
No command 'asdf' found, did you mean:
 Command 'sdf' from package 'sdf' (universe)
 Command 'sadf' from package 'sysstat' (main)
 Command 'asdfg' from package 'aoeui' (universe)
asdf: command not found

The repository... does not have a Release file

Installation fails (at least on xenial) with:

The repository 'https://deb.nodesource.com/node_6.x xenial Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use

From what I can tell, this role uses the same repositories specified by nodesource for Manual installation.

Was working until yesterday (17th) as far as I'm aware. Is there a wider issue at nodesource perhaps? I find it odd that I can't find others reporting the same problem...

Regression for Ubuntu 14.04? SSL certificate error on adding nodesource key

I seem to be getting a regression of #43 on Ubuntu 14.04 LTS:

TASK: [geerlingguy.nodejs | Add Nodesource apt key.] ************************** <localhost> REMOTE_MODULE apt_key id=68576280 state=present url='https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280' failed: [localhost] => {"failed": true, "item": ""} msg: Failed to validate the SSL certificate for keyserver.ubuntu.com:443. Use validate_certs=no or make sure your managed systems have a valid CA certificate installed. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible

This seems to be the case for both master and 4.0.x branches. ca-certificates is as up to date as Trusty Tahr wants it to be:

$ sudo dpkg -l ca-certificates Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-=============================================-===========================-===========================-=============================================================================================== ii ca-certificates 20160104ubuntu0.14.04.1 all Common CA certificates

vs. https://launchpad.net/ubuntu/+source/ca-certificates

However, running the following directly allows me to proceed:

wget -qO - 'https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280' | sudo apt-key add -

Does that not do the same certificate checks? Is it that they're running the HTTPS call as different users?

I then get a separate error on "Ensure Node.js and npm are installed" ("this module requires key=value arguments") but I'll check separately for any existing bug reports rather than complicate this issue!

Add option do enable/disable role by single variable

Howdy,

what do you think about following approach:

main.yml

- include: nodejs.yml
  when: nodejs_enabled
  tags: [nodejs]

nodejs.yml

// Tasks here

I use the mentioned approach in my roles, works perfectly and helps to keep my playbooks really clear without any when conditionals. The *_enabled variable is being set up in defaults/main.yml file (my roles are disabled by default). Could create pull requests for your roles I'm using, but would like to know if you're going to accept those.

node version assertion and apt-get syntax are conflicting

Runs into problem when trying to install 4.2

tasks assert that the version is 4.x
This causes the apt-get command to become
apt-get install 4.x.* which is a version that the nodesource debian packages actually have.

4 would work. Becomes 4.*, apt end up with 4.2.1
4.2 also works.

However 4 or 4.2 fail the assertion since its not in the form 4.x

Additional complication though that the nodesource repos still need to be 4.x

I'm currently working around this by introducing a nodesource_version=4.x variable along with the nodejs_version=4.2, but open to ideas if you see a better way.

Unable to access globally installed NPM module in non login session

With https://github.com/geerlingguy/ansible-role-nodejs/blob/master/tasks/main.yml#L20-L24 applying only to login session, say I Install bower with nodejs_npm_global_packages

Trying to do

- name: Install Bower dependencies
  command: bower install
  args:
    chdir: "{{ my_path }}"

or even

- name: Install Bower dependencies
  shell: bower install
  args:
    chdir: "{{ my_path }}"

will not work, because Ansible run those as non-login shell, never hitting the /etc/profile.d/npm.sh.

Installing 'forever' fails

spurious \nnpm in install path. Couldn't find obvious culprit.
I don't think I need forever for my simple sass transpiles on Ubuntu so I worked around by setting my nodes_forever: false
Need to investigate further.

Installation of node 8.x not working for CentOS7

node_version: "8.x" fails with error:

TASK [geerlingguy.nodejs : Ensure Node.js and npm are installed.] ******************************************************************************************************************************************
fatal: [10.10.1.131]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'nodejs-8.*' found available, installed or updated", "rc": 126, "results": ["No package matching 'nodejs-8.*' found available, installed or updated"]}

Suggestion: nodesource version out of date

final edit:

nodejs 4.x is now supported via nodesource. Could you update please? :)

nodejs_version: "4.x"

source:

https://github.com/nodesource/distributions/blob/master/deb/src/build.sh

"Ensure npm global packages are installed." hangs

ansible-playbook --version
ansible-playbook 2.2.0.0

these two tasks hang:

# TODO: Remove this task after Ansible 2.x npm module bug is fixed. See:
# https://github.com/ansible/ansible-modules-extras/issues/1375
- name: Ensure npm global packages are installed.
  npm:
    name: "{{ item.name }}"
    version: "{{ item.version | default('latest') }}"
    global: yes
    state: present
  environment:
    NPM_CONFIG_PREFIX: "{{ npm_config_prefix }}"
    NODE_PATH: "{{ npm_config_prefix }}/lib/node_modules"
    NPM_CONFIG_UNSAFE_PERM: "{{ npm_config_unsafe_perm }}"
  with_items: "{{ nodejs_npm_global_packages }}"

- name: Ensure npm global packages are at the latest release.
  npm:
    name: "{{ item.name }}"
    version: "{{ item.version | default('latest') }}"
    global: yes
    state: latest
  environment:
    NPM_CONFIG_PREFIX: "{{ npm_config_prefix }}"
    NODE_PATH: "{{ npm_config_prefix }}/lib/node_modules"
    NPM_CONFIG_UNSAFE_PERM: "{{ npm_config_unsafe_perm }}"
  with_items: "{{ nodejs_npm_global_packages }}

Workaround: commenting out the lines in:

/usr/local/etc/ansible/roles/geerlingguy.nodejs/tasks/main.yml

CentOS 6 test container returning 'stat /sbin/init: no such file or directory'

docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"/sbin/init\\\": stat /sbin/init: no such file or directory\"\n".

From cron-based failing build: https://travis-ci.org/geerlingguy/ansible-role-nodejs/jobs/239820030

If I can't get it resolved quickly-ish, I'm planning on disabling the test for the time being. I wonder if it's something upstream that's changed and is causing the geerlingguy/docker-centos6-ansible image to have issues?

Updating from 5.x to 6.x has file conflicts

Hello,

We used 5.x until today when we wanted to update to 6.x. But there are many file conflicts.

Based on my understanding of Ansible, the below RedHat task:

- name: Ensure Node.js and npm are installed.
yum: "name=nodejs-{{ nodejs_version[0] }}.* state=present enablerepo='epel,nodesource'"

is equivalent to yum install nodejs-6.*. Both fail with the same error. yum update nodejs also fails, the log is below.

root@staging: ~ > yum update nodejs
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:5.12.0-1nodesource.el7.centos will be updated
---> Package nodejs.x86_64 1:6.9.4-2.el7 will be an update
--> Processing Dependency: npm = 1:3.10.10-1.6.9.4.2.el7 for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Processing Dependency: libuv >= 1:1.9.1 for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Processing Dependency: libuv.so.1()(64bit) for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Processing Dependency: libicuuc.so.50()(64bit) for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Processing Dependency: libicui18n.so.50()(64bit) for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Processing Dependency: libicudata.so.50()(64bit) for package: 1:nodejs-6.9.4-2.el7.x86_64
--> Running transaction check
---> Package libicu.x86_64 0:50.1.2-15.el7 will be installed
---> Package libuv.x86_64 1:1.10.2-1.el7 will be installed
---> Package npm.x86_64 1:3.10.10-1.6.9.4.2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================================
 Package                                        Arch                                           Version                                                            Repository                                    Size
=====================================================================================================================================================================================================================
Updating:
 nodejs                                         x86_64                                         1:6.9.4-2.el7                                                      epel                                         4.6 M
Installing for dependencies:
 libicu                                         x86_64                                         50.1.2-15.el7                                                      base                                         6.9 M
 libuv                                          x86_64                                         1:1.10.2-1.el7                                                     epel                                         109 k
 npm                                            x86_64                                         1:3.10.10-1.6.9.4.2.el7                                            epel                                         2.4 M

Transaction Summary
=====================================================================================================================================================================================================================
Install             ( 3 Dependent packages)
Upgrade  1 Package

Total size: 14 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test


Transaction check error:
  file /usr/lib/node_modules/npm/node_modules/node-gyp from install of npm-1:3.10.10-1.6.9.4.2.el7.x86_64 conflicts with file from package nodejs-5.12.0-1nodesource.el7.centos.x86_64
  file /usr/lib/node_modules/npm/doc from install of npm-1:3.10.10-1.6.9.4.2.el7.x86_64 conflicts with file from package nodejs-5.12.0-1nodesource.el7.centos.x86_64
  file /usr/lib/node_modules/npm/html from install of npm-1:3.10.10-1.6.9.4.2.el7.x86_64 conflicts with file from package nodejs-5.12.0-1nodesource.el7.centos.x86_64
  file /usr/lib/node_modules/npm/man from install of npm-1:3.10.10-1.6.9.4.2.el7.x86_64 conflicts with file from package nodejs-5.12.0-1nodesource.el7.centos.x86_64

So I may do a PR to check the current version installed, determine whether the requested version is different than the version installed, if yes remove the old binaries, if yes install the new requested version.

What do you think?

Thank you for your work.

Getting message 'The repository does not have a Release' file on Xenial

I provision this role with default settings on Ubuntu 16.04 server and get this error:

TASK [nodejs : Add NodeSource PPA for latest version of Node.js.] **************
System info:
  Ansible 2.2.1.0; Darwin
  Trellis at "Forward extra bin/deploy.sh parameters to ansible-playbook"
---------------------------------------------------
MODULE FAILURE
Traceback (most recent call last):
  File "/tmp/ansible_JdB_w3/ansible_module_apt_repository.py", line 538, in
<module>
    main()
  File "/tmp/ansible_JdB_w3/ansible_module_apt_repository.py", line 527, in
main
    cache.update()
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 454, in update
    raise FetchFailedException(e)
apt.cache.FetchFailedException: W:The repository 'http://ppa.launchpad.net
/chris-lea/node.js/ubuntu xenial Release' does not have a Release file.,
W:Data from such a repository can't be authenticated and is therefore
potentially dangerous to use., W:See apt-secure(8) manpage for repository
creation and user configuration details., E:Failed to fetch
http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/xenial/main/binary-
amd64/Packages  404  Not Found, E:Some index files failed to download. They
have been ignored, or old ones used instead.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: apt.cache.FetchFailedException: W:The repository 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.
fatal: [flops-staging]: FAILED! => {"changed": false, "failed": true, "module_stdout": ""}

Field args has an invalid value

I didn't have this problem before, however after doing a provision I came up with this error.

TASK [geerlingguy.nodejs : Define nodejs_install_npm_user] *********************
fatal: [default]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible_user' is undefined\n\nThe error appears to have been in '/vagrant/ansible/roles/geerlingguy.nodejs/tasks/main.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Define nodejs_install_npm_user\n  ^ here\n"}

What seems to be causing the issue?

npm_config_prefix default shouldn't be a relative path

Hello!
#28 added a default npm_config_prefix of ~/.npm-global, and this path is added to the global path (for all users). So for all other user except the ansible_ssh_user, this path will not resolve because it will be expanded as their home folder.

I think a better default would be something like: /usr/local/lib/npm, so the path will resolve for all users.

What do you think?
cc @thom8

'ansible_user' is undefined

Currently getting this error when running the role dependency:
==> default: TASK [nodejs : Define nodejs_install_npm_user] *********************************
==> default: fatal: [controller]: FAILED! => {"failed": true, "msg": "'ansible_user' is undefined"}

EDIT: My bad for skimming through the README

nodejs_version: "0.12" fails

If I set nodejs_version to "0.12", everything works fine, but with 0.12, it fails:

➜  provisioning git:(master) ✗ ansible-playbook playbook.yml -i inventory -u centos

PLAY [basic] ****************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [staging]

TASK: [geerlingguy.nodejs | Make sure nodejs_version is set correctly.] ******* 
failed: [staging] => {"assertion": "nodejs_version == \"0.10\"", "evaluated_to": false, "failed": true}

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/mehulkar/playbook.retry

staging                    : ok=1    changed=0    unreachable=0    failed=1   

I'm new to Ansible though, so it's possible I'm using it wrong.

Nodesource SNI causing build failure on CentOS 6.x

See error message:

TASK [role_under_test : Import Nodesource RPM key.] ****************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to validate the SSL certificate for rpm.nodesource.com:443. Make sure your managed systems have a valid CA certificate installed. If the website serving the url uses SNI you need python >= 2.7.9 on your managed machine or you can install the `urllib3`, `pyopenssl`, `ndg-httpsclient`, and `pyasn1` python modules to perform SNI verification in python >= 2.6. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible"}

It started failing after Nodesource moved to Cloudfront, using new SSL certs that use SNI (which isn't easily supported by the version of Python/other deps installed on CentOS 6.

For Ubuntu, I fixed by making the same change the official Nodesource Ansible role made: 0372961#diff-ebbe0c3ff3753db31a12af649c45a099R7 — see https://github.com/nodesource/ansible-nodejs-role/pull/34/files#diff-2444ad0870f91f17ca6c2a5e96b26823R16

For CentOS, not exactly sure what to do to get 6 up and running again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.