-
Notifications
You must be signed in to change notification settings - Fork 47
Allow installation of NPM packages #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hey sorry for the delay in reviewing this, we haven't published this yet as I am waiting for @rvagg to get back from holidays. Plan on testing this more thoroughly once he gets back, hence the stall. Is there a reason you have used a place holder entry in the array of global modules? Could you just declare an empty array as the default? Cheers |
Only reason: I didn't know how to off hand and was working on a bunch of other tasks to setup my server. But I will change that quickly. |
Fwiw, installing npm modules doesn't belong in this role IMO. Couldn't we create an |
@thlorenz I see the point of having the two separate, but I also think they are linked for many people's deployment. As it is such a simple piece, I don't see the need for separating them out. |
Everything starts out as a very simple piece, but most grow more complex afterwards. However once it is included with this role it can never be removed without breaking backwards compat. Therefore I maintain it'd be a better idea to have it separate. |
Good point. Well, do you want to pull this out and put it into its own repo / ansible-galaxy? I think it would make sense to have it be within the nodesource org, for consistency? |
@iamcarrico nice idea, lets see what the others think about that. |
Well just putting in my $0.02 here... I went through this sort of thing making Debian / Ubuntu packages a ways back. I used to make separate packages for node, node devel (header files and stuff), and npm. I then stopped doing that and started making a single package that had everything at the request of Joyent. The reasoning was that these days, you're not really using node correctly if you're not using npm, and you can't use npm without the development files. So while I understand that having separate roles is sort of the "pure" thing to do, if we're following the same logic we'd just have a single role that installed everything. |
What's the use-case here? The only sensible one I can see for an Ansible role is to install global packages as commands, like |
Not all ansible scripts are for deployment servers--- I use this for a local vagrant box. I would like to install some global packages for me always to use (e.g. gulp and yeoman) |
ah yes, gulp, yeoman, grunt, those are all pretty popular globals, ok, +1 from me, we should make a separate role for this |
Yep +1 for separate role, and great to see some good discussion on this, I love open source. We also install node-gyp via Ansible at the moment albeit in our CI role (which is of course way to big). |
👍 Open source. Let me know if I can help y'all on this one. |
@wolfeidau we're doing that in our docker images: https://github.com/nodesource/docker-node/blob/master/Dockerfile#L16-L17 tho it's mainly so that we prime the images with the stuff downloaded to .node-gyp so you don't have to wait if you run any builds as root. |
O that is a damn good idea, mite be worth optionally doing the same thing in this role. Tricks like that make stuff like this invaluable. |
We are currently using this to install packages via |
@conorgil this code is just a wrapper around that. |
Howdy!
I was looking for an ansible way to install node, and since most of them go though the old PPA-- this was the only one that does it the new way.
Anyway--- I made a few minor changes, a couple yml syntax changes (couldn't run it without those changes). And then created a way to install npm packages as well. I don't know of a way to use items only if a variable exists, so instead I made one with a dummy package name. Ansible will then install everything except that package (if the user doesn't override).
Also... it isn't up on Ansible galaxy yet. I am guessing that is because this is ... 7 days old? Either way, can you push it? 👍
Thanks mate!