Giter VIP home page Giter VIP logo

ansible-role-nodejs's Issues

Error while installing some nodes version

Hi guy,

I got a problem while using your some role, for lts version of node js :

TASK [fubarhouse.nodejs : include_tasks] ***************************************
included: /vagrant/provisioning/roles/fubarhouse.nodejs/tasks/setup.yml for projet-TA70

TASK [fubarhouse.nodejs : NodeJS | Install dependencies (CentOS)] **************
skipping: [projet-TA70] => (item=[]) 

TASK [fubarhouse.nodejs : NodeJS | Install dependencies (Debian)] **************
ok: [projet-TA70] => (item=[u'curl', u'gcc', u'git', u'findutils', u'make', u'rsync', u'tar'])
[DEPRECATION WARNING]: State 'installed' is deprecated. Using state 'present' 
instead.. This feature will be removed in version 2.9. Deprecation warnings can
 be disabled by setting deprecation_warnings=False in ansible.cfg.

TASK [fubarhouse.nodejs : NodeJS | Install dependencies (RedHat)] **************
skipping: [projet-TA70] => (item=[]) 

TASK [fubarhouse.nodejs : Set default ivm installation directory] **************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : Set default nvm installation directory] **************
ok: [projet-TA70]

TASK [fubarhouse.nodejs : include_tasks] ***************************************
included: /vagrant/provisioning/roles/fubarhouse.nodejs/tasks/nvm.yml for projet-TA70

TASK [fubarhouse.nodejs : NVM | Looking at shell profiles] *********************
ok: [projet-TA70] => (item=.bash_profile)

TASK [fubarhouse.nodejs : NVM | Clean-up] **************************************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Clean-up default version from shell profiles] ***
skipping: [projet-TA70] => (item={'_ansible_parsed': True, u'stat': {u'exists': False}, u'changed': False, '_ansible_no_log': False, 'item': u'.bash_profile', '_ansible_item_result': True, 'failed': False, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}) 

TASK [fubarhouse.nodejs : NVM | Clean-up other versions from shell profiles] ***
skipping: [projet-TA70] => (item=[{'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'failed': False, u'changed': False, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}, u'8.11.1']) 
skipping: [projet-TA70] => (item=[{'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'failed': False, u'changed': False, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}, u'10.0.0']) 

TASK [fubarhouse.nodejs : NodeJS | Remove imported exports not associated to specific versions] ***
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Check] *****************************************
ok: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Get distribution] ******************************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Create temporary extraction directory] *********
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Create pernament extraction directory] *********
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Unpack distribution] ***************************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Moving to installation directory] **************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Moving to installation directory] **************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Remove temporary data] *************************
skipping: [projet-TA70] => (item=/tmp/v0.33.8.tar.gz) 
skipping: [projet-TA70] => (item=/tmp/nvm-v0.33.8) 

TASK [fubarhouse.nodejs : NVM | Clone] *****************************************
ok: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Install] ***************************************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Create an executable] **************************
ok: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Get versions] **********************************
ok: [projet-TA70]

TASK [fubarhouse.nodejs : NVM | Ensure shell profiles are available] ***********
ok: [projet-TA70] => (item={'_ansible_parsed': True, u'stat': {u'exists': False}, u'changed': False, '_ansible_no_log': False, 'item': u'.bash_profile', '_ansible_item_result': True, 'failed': False, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None})

TASK [fubarhouse.nodejs : NVM | Ensure shell profiles are configured for default version] ***
skipping: [projet-TA70] => (item={'_ansible_parsed': True, 'changed': False, '_ansible_no_log': False, 'item': {'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'item': u'.bash_profile', u'changed': False, 'failed': False, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}, '_ansible_item_result': True, u'failed': False, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u"/root/{'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'failed': False, u'changed': False, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}", u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, 'failed_when_result': False, '_ansible_ignore_errors': None, u'msg': u'File name too long'}) 

TASK [fubarhouse.nodejs : NVM | Ensure shell profiles are configured for other versions] ***
skipping: [projet-TA70] => (item=[{'_ansible_parsed': True, 'changed': False, '_ansible_no_log': False, u'failed': False, '_ansible_item_result': True, 'item': {'_ansible_parsed': True, u'stat': {u'exists': False}, u'changed': False, '_ansible_no_log': False, 'failed': False, '_ansible_item_result': True, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u"/root/{'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'failed': False, u'changed': False, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}", u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, 'failed_when_result': False, '_ansible_ignore_errors': None, u'msg': u'File name too long'}, u'8.11.1']) 
skipping: [projet-TA70] => (item=[{'_ansible_parsed': True, 'changed': False, '_ansible_no_log': False, u'failed': False, '_ansible_item_result': True, 'item': {'_ansible_parsed': True, u'stat': {u'exists': False}, u'changed': False, '_ansible_no_log': False, 'failed': False, '_ansible_item_result': True, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u"/root/{'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'failed': False, u'changed': False, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, '_ansible_ignore_errors': None}", u'get_md5': None, u'get_mime': True, u'get_attributes': True}}, 'failed_when_result': False, '_ansible_ignore_errors': None, u'msg': u'File name too long'}, u'10.0.0']) 

TASK [fubarhouse.nodejs : include_tasks] ***************************************
skipping: [projet-TA70]

TASK [fubarhouse.nodejs : include_tasks] ***************************************
included: /vagrant/provisioning/roles/fubarhouse.nodejs/tasks/nodejs.yml for projet-TA70

TASK [fubarhouse.nodejs : NodeJS | Check] **************************************
ok: [projet-TA70]

TASK [fubarhouse.nodejs : NodeJS | Install all requested versions] *************
skipping: [projet-TA70] => (item=8.11.1) 
skipping: [projet-TA70] => (item=8.11.1) 
skipping: [projet-TA70] => (item=10.0.0) 

TASK [fubarhouse.nodejs : NodeJS | Switching] **********************************
fatal: [projet-TA70]: FAILED! => {"changed": false, "cmd": "/usr/local/bin/nvm use --delete-prefix 8.11.1", "delta": "0:00:00.351227", "end": "2018-05-01 12:19:13.303721", "msg": "non-zero return code", "rc": 3, "start": "2018-05-01 12:19:12.952494", "stderr": "N/A: version \"8.11.1 -> N/A\" is not yet installed.\n\nYou need to run \"nvm install 8.11.1\" to install it before using it.", "stderr_lines": ["N/A: version \"8.11.1 -> N/A\" is not yet installed.", "", "You need to run \"nvm install 8.11.1\" to install it before using it."], "stdout": "", "stdout_lines": []}
	to retry, use: --limit @/vagrant/provisioning/bootstrap.retry

If think it's due to this part of the code :

- name: "NodeJS | Check"
shell: "{{ nvm_symlink_exec }} ls | cat"
register: installed_nodejs_versions
changed_when: false
- name: "NodeJS | Install all requested versions"
shell: "{{ nvm_symlink_exec }} install {{ item }}"
when: 'item in nodejs_available_versions.stdout and item not in installed_nodejs_versions.stdout'
with_items:
- "{{ node_version }}"
- "{{ node_versions }}"

As, for me, result of the first command is :

root@projet-TA70:/home/vagrant# nvm ls | cat
->      v10.0.0
default -> 10.0.0 (-> v10.0.0)
node -> stable (-> v10.0.0) (default)
stable -> 10.0 (-> v10.0.0) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.14.2 (-> N/A)
lts/carbon -> v8.11.1 (-> N/A)

As you can see, version if ever present, but is not installed

Here are my set-up :

vars/all.yml

node_version: 8.11.1

node_versions:
  - 8.11.1
  - 10.0.0

playbook.yml

- name: Install prerequisits for the Nginx web server
  hosts: webservers
  become: true
  roles:
    - fubarhouse.nodejs

(nvm / node isn't present on the host before the start of this role)

Hope you can help

Best regards

Centos 7 install fails, default version of git lacks the features for nvm install.sh

fatal: [10.0.0.11]: FAILED! => {"changed": true, "cmd": "~/.nvm/install.sh", "delta": "0:00:00.981281", "end": "2018-05-07 16:53:59.559854", "failed": true, "rc": 1, "start": "2018-05-07 16:53:58.578573", "stderr": "Failed to update nvm, run 'git fetch' in /root/.nvm yourself.", "stderr_lines": ["Failed to update nvm, run 'git fetch' in /root/.nvm yourself."], "stdout": "=> nvm is already installed in /root/.nvm, trying to update using git\n\r=> ", "stdout_lines": ["=> nvm is already installed in /root/.nvm, trying to update using git", "", "=> "]}

PLAY RECAP **************************************************************************************************************************************************
10.0.0.1               : ok=62   changed=35   unreachable=0    failed=1

From the nvm install.sh file, the git fetch fails

git --git-dir=.git --work-tree=. fetch origin tag "v0.33.8" --depth=1
fatal: git fetch-pack: expected shallow list

This issue has come up in other circles.

Not sure what the best route is around this for your role, I just wanted to let others know this is a problem.

Some suggestions

  • Have a dependency on an IUS (e.g. linuxhq.ius) and latest-git-centos7 role.
  • ignore it (probably best) and put a dependency on a later version of git as a requirement for the role.

Question about using role as non-root user

Hello, Thanks for making this ansible role!
My goal is to use it to provision a server with nvm, node, and npm usable by my non-root user who has sudo privileges.

I have a task that looks like this (cu.nodesjs is my fork name of your repo):

- name: Include cu.nodejs role
  become: yes
  become_user: "{{admin_user}}"
  include_role:
    name: cu.nodejs

After running the above successfully I have access to nvm when logged into my server as the admin_user (not root).
However I don't have access to node or npm. Is it possible to access these as non-root user?

Thanks for your time.

Advice for failing 'Ensure permissions are set'

Most likely user error, but can you point me in the right direction. Standard vanilla aws ubuntu64, remote_user=ubuntu

TASK [fubarhouse.nodejs : NVM | Ensure permissions are set] *******************************************************************************************************
failed: [web-server] (item=/usr/local/lib/node_modules) => {"changed": false, "failed": true, "item": "/usr/local/lib/node_modules", "msg": "There was an issue creating /usr/local/lib/node_modules as requested: [Errno 13] Permission denied: '/usr/local/lib/node_modules'", "path": "/usr/local/lib/node_modules", "state": "absent"}

npm configure fails

Configure task fails, despite apparent success.
Throwing a fails_when: false fixes this, so I'll introduce a hotfix tonight.

Overhaul shell profiles

  • Shell profiles should not be created if they don't exist
  • Tasks should skip if configured shell profiles do not exist

Add Debian9 support

Recently I've forked the Debian 8 Docker image and transformed them into a Debian 7 and Debian 9 docker image, with automated builds specifically for Ansible.

Those images are now passing tests for my golang role, and we should have that support here.

iojs installation error, even when disabled

This is my nodejs installation playbook:

---
- hosts: nodejs
  become: yes
  roles:
    - fubarhouse.nodejs
  vars:
    node_version: 6.3.1
    node_versions:
      - 6.3.1
    install_iojs: false
    install_ivm: false

Despite disabling iojs installation, it still tries, and then fails with this error:

TASK [fubarhouse.nodejs : IOJS | Get versions] ***********************************************************************************************************************************************************************************************************************
ok: [node1.example.co.uk]

TASK [fubarhouse.nodejs : IOJS | Check for local default install] ****************************************************************************************************************************************************************************************************
skipping: [node1.example.co.uk]

TASK [fubarhouse.nodejs : IOJS | Check for all local installs] *******************************************************************************************************************************************************************************************************
skipping: [node1.example.co.uk] => (item=6.3.1) 

TASK [fubarhouse.nodejs : IOJS | Install default] ********************************************************************************************************************************************************************************************************************
fatal: [node1.example.co.uk]: FAILED! => {"failed": true, "msg": "The conditional check 'fubarhouse_npm_io_install_result is defined and not fubarhouse_npm_io_install_result.stat.exists and \"{{ node_version }}\" in iojs_available_versions.stdout' failed. The error was: error while evaluating conditional (fubarhouse_npm_io_install_result is defined and not fubarhouse_npm_io_install_result.stat.exists and \"{{ node_version }}\" in iojs_available_versions.stdout): 'dict object' has no attribute 'stat'\n\nThe error appears to have been in '/usr/local/etc/ansible/roles/fubarhouse.nodejs/tasks/iojs.yml': line 38, 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: \"IOJS | Install default\"\n  ^ here\n"}

I made it run by commenting out the lines in main.yml that include iojs.yml, but I don't see why it fails nor why setting those vars doesn't prevent it from trying.

Support IVM (iojs version manager)

I've been complaining to myself for some time about iojs tasks being unusable, so I've found this little gem and tested it. I want to integrate it, not because this role needs it but because it would extend capability in a relevant manner.

https://github.com/demohi/ivm

Broken in 2.4?

I'm trying to install on Ubuntu 16.04 using ansible 2.4.0, but it fails to install nvm (though it doesn't notice), and then other steps fail as a consequence. This is my playbook:

---
- hosts: adminservers
  become: yes
  roles:
    - fubarhouse.nodejs
  vars:
    node_version: 6.3.1
    node_versions:
      - 6.3.1
    install_iojs: false
    install_ivm: false
  tasks:
    - name: Install PM2
      npm:
        name: pm2
        global: yes

Everything seems to work up to the point where it tries to run nvm, which fails as it's not there (also note the deprecation notices for ansible 2.4):

[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 'import_tasks' for static inclusions or 'include_tasks' for dynamic inclusions. This feature will be removed in a future release. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg.

PLAY [adminservers] **************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : NodeJS | Install dependencies (CentOS)] ****************************************************************************************************************************************************************************************************
skipping: [host.example.com] => (item=[]) 

TASK [fubarhouse.nodejs : NodeJS | Install dependencies (Debian)] ****************************************************************************************************************************************************************************************************
ok: [host.example.com] => (item=[u'curl', u'gcc', u'git', u'findutils', u'make', u'rsync', u'tar'])

TASK [fubarhouse.nodejs : NodeJS | Install dependencies (RedHat)] ****************************************************************************************************************************************************************************************************
skipping: [host.example.com] => (item=[]) 

TASK [fubarhouse.nodejs : Define user variable for ssh use] **********************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : Define user variable for non-ssh use] ******************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : Get $HOME] *********************************************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : Set $HOME] *********************************************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : Set default ivm installation directory] ****************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : Set default nvm installation directory] ****************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Looking at shell profiles] ***********************************************************************************************************************************************************************************************************
ok: [host.example.com] => (item=.bash_profile)

TASK [fubarhouse.nodejs : NVM | Clean-up] ****************************************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Clean-up default version from shell profiles] ****************************************************************************************************************************************************************************************
skipping: [host.example.com] => (item={'_ansible_parsed': True, u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, 'failed': False, u'changed': False, 'item': u'.bash_profile', u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': True, u'get_mime': True, u'get_attributes': True}}}) 

TASK [fubarhouse.nodejs : NVM | Clean-up other versions from shell profiles] *****************************************************************************************************************************************************************************************
skipping: [host.example.com] => (item=[{'_ansible_parsed': True, u'stat': {u'exists': False}, u'changed': False, '_ansible_no_log': False, 'item': u'.bash_profile', '_ansible_item_result': True, 'failed': False, u'invocation': {u'module_args': {u'checksum_algorithm': u'sha1', u'get_checksum': True, u'follow': False, u'path': u'.bash_profile', u'get_md5': True, u'get_mime': True, u'get_attributes': True}}}, u'6.3.1']) 

TASK [fubarhouse.nodejs : NodeJS | Remove imported exports not associated to specific versions] **********************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Check] *******************************************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Ensure permissions are set] **********************************************************************************************************************************************************************************************************
ok: [host.example.com] => (item={u'path': u'/usr/local/lib/node_modules'})
ok: [host.example.com] => (item={u'path': u'/Users/ubuntu/.npm'})
ok: [host.example.com] => (item={u'path': u'/Users/ubuntu/.nvm'})

TASK [fubarhouse.nodejs : NVM | Get distribution] ********************************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Create temporary extraction directory] ***********************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Create pernament extraction directory] ***********************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Unpack distribution] *****************************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Moving to installation directory] ****************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Moving to installation directory] ****************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Remove temporary data] ***************************************************************************************************************************************************************************************************************
skipping: [host.example.com] => (item=/tmp/6.3.tar.gz) 
skipping: [host.example.com] => (item=/tmp/nvm-6.3) 

TASK [fubarhouse.nodejs : NVM | Clone] *******************************************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Install] *****************************************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Ensure permissions are set] **********************************************************************************************************************************************************************************************************
ok: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Create an executable] ****************************************************************************************************************************************************************************************************************
skipping: [host.example.com]

TASK [fubarhouse.nodejs : NVM | Get versions] ************************************************************************************************************************************************************************************************************************
fatal: [host.example.com]: FAILED! => {"changed": false, "cmd": "/usr/local/bin/nvm ls-remote", "delta": "0:00:00.008074", "end": "2017-09-27 14:18:44.646110", "failed": true, "msg": "non-zero return code", "rc": 127, "start": "2017-09-27 14:18:44.638036", "stderr": "/bin/bash: /usr/local/bin/nvm: No such file or directory", "stderr_lines": ["/bin/bash: /usr/local/bin/nvm: No such file or directory"], "stdout": "", "stdout_lines": []}
        to retry, use: --limit @/Users/marcus/ansible-config-scripts/nodejs.retry

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************************************
host.example.com : ok=11   changed=0    unreachable=0    failed=1   

Install failing with unicode error on install all

Here's my playbook:

---
- hosts: nodejs
  become: yes
  roles:
    - fubarhouse.nodejs
  vars:
    node_version: 6.3
    node_versions:
      - 6.3

It gets quite a long way but then:

fatal: [www.example.co.uk]: FAILED! => {"failed": true, "msg": "The conditional check '\"{{ item }}\" in nodejs_available_versions.stdout and item not in installed_nodejs_versions.stdout' failed. The error was: Unexpected templating type error occurred on ({% if \"6.3\" in nodejs_available_versions.stdout and item not in installed_nodejs_versions.stdout %} True {% else %} False {% endif %}): coercing to Unicode: need string or buffer, float found\n\nThe error appears to have been in '/usr/local/etc/ansible/roles/fubarhouse.nodejs/tasks/nodejs.yml': line 17, 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: \"NodeJS | Install all requested versions\"\n  ^ here\n"}

This leaves it in a broken state, and running it again does this:

TASK [www.example.co.uk : NVM | Clone/Update] **********************************
fatal: [vpntest.gniuva.co.uk]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to x.x.x.x closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_AbPz7c/ansible_module_git.py\", line 1040, in <module>\r\n    main()\r\n  File \"/tmp/ansible_AbPz7c/ansible_module_git.py\", line 994, in main\r\n    result.update(changed=True, after=remote_head, msg='Local modifications exist')\r\nUnboundLocalError: local variable 'remote_head' referenced before assignment\r\n", "msg": "MODULE FAILURE"}

Assess validity of IOJS tasks file and remove if applicable.

The IOJS tasks file is essentially superseded.

With the usage of IVM now it should be removed and could potentially cause an issue like #22 from coming up especially where no iojs version is specified for installation.

I'll get this done over the coming few days.

Add in io.js with installation logic

As the title says, add in logic which detects a version of io.js and installs when it's not present.
Identical to the implementation of the node.js provision, built in mind for systems reprovisioning to prevent errors and maintain performance to skip when necessary.

Will use default versions in defaults/main.yml.

Audit and remove fubarhouse_npm variable object

Variables need refactoring:

fubarhouse_npm:
  clean_install: true
  user_dir: /Users/karl/
  nvm_install_dir: /Users/karl/.nvm
  shell_profiles:
  - filename: .bash_profile
  folder_paths:
  - path: "/usr/local/lib/node_modules"
  - path: "/Users/{{ fubarhouse_user }}/.npm"
  - path: "/Users/{{ fubarhouse_user }}/.nvm"
  nvm_repo: "https://github.com/xtuple/nvm.git"
  nvm_symlink_exec: /usr/local/bin/nvm

Support for Yarn

So Travis now supports Yarn officially, and I thought it would be great to add another fantastic tool here which is relevant to the needs to the NodeJs community.

All is looking well which can be found in the branch feature-yarn at the moment, but I'm wondering if this should be cut off into it's own role. The role would be lightweight - it carries essentially no ties to anything used in the nodejs role... Once tests pass I'll decide what to do - but I am hesitant to PR it because this tool is basically optional and not really connected to node.

Update for Ansible v2

changing sudo references to use become module.
there are other dependencies, so this will be done in the future

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.