Open gregorskii opened 7 years ago
Hey @gregorskii, where are you setting the nvm_node_version
Hey @pablocrivella,
Its being passed into Ansible as a extra-var from shell:
local NODE_VERSION=$(cat ./.nvmrc | sed 's/v//g')
packer build IMAGE -var 'NODE_VERSION=${NODE_VERSION}'
Then to my main playbook from Packer:
{
"type": "ansible",
"playbook_file": "ansible/jenkins.yml",
"extra_arguments": [
"--extra-vars", "NODE_VERSION={{user `NODE_VERSION`}}"
]
},
Then to the playbook (ansible/jenkins.yml):
---
- hosts: all
gather_facts: yes
become: True
vars:
nvm_node_version: "{{NODE_VERSION}}"
vars_files:
- group_vars/nvm-vars.yml
roles:
- pablocrivella.nvm
Its evaluating to the string 6.6.0
when its in Ansible. I add the 'v' in Ansible "v{{nvm_node_version}}" as I was debugging whether the v mattered.
Ansible reports it installs the node version when in the nvm_env
mode for user
, but when it tries to install packages with that version nvm fails. It does however appear to work in system mode, but then I do not get user specific nvm versions and installations.
Thanks!
Hey @gregorskii i will try to take a look at this later today
Hi there,
Finding this role fails while installing npm packages from the
nvm_global_packages
list.The error appears to be due to the
nvm_node_versions
being "N/A", although the item being passed to the task includes the right value:My config:
Thanks