78 lines
2.1 KiB
Markdown
78 lines
2.1 KiB
Markdown
Ansible NodeJS
|
|
==============
|
|
|
|
An Ansible role that helps setup and install modern versions of NodeJS for Ubuntu systems. This role aims to simplify
|
|
the setup of both production and local development machines.
|
|
|
|
This role is a component of the [NGINX NodeJS role](https://bitbucket.org/dorianpula/ansible-nginx-nodejs-supervisor)
|
|
used to deploy NodeJS web applications.
|
|
|
|
|
|
Requirements
|
|
------------
|
|
|
|
This role is Ubuntu specific. Also note that NodeJS 5.x works on Ubuntu 12.04 and greater.
|
|
|
|
Role Variables
|
|
--------------
|
|
|
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
|
|
|
Example Playbook
|
|
----------------
|
|
|
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
|
|
|
- hosts: servers
|
|
roles:
|
|
- { role: username.rolename, x: 42 }
|
|
|
|
### Local Development Setup
|
|
|
|
This role can be used to provision and setup a local development environment.
|
|
|
|
Create a local playbook `local_playbook.yml`:
|
|
|
|
```
|
|
---
|
|
- hosts: localhost
|
|
user: $MY_USER_NAME
|
|
roles:
|
|
- { role: "ansible-nodejs",
|
|
node_version_family: "4.x",
|
|
local_development: {
|
|
user: "$MY_USER_NAME",
|
|
enabled: true
|
|
},
|
|
globally_installed_tools: [
|
|
"browserify",
|
|
"coffee-script",
|
|
"less",
|
|
"npmrc",
|
|
"grunt-cli",
|
|
"karma-cli"
|
|
]
|
|
}
|
|
```
|
|
|
|
Create a inventory for connecting to the localhost: `localhost_inventory`:
|
|
|
|
```
|
|
localhost ansible_connection=local ansible_become=true
|
|
```
|
|
|
|
Run the playbook locally:
|
|
```
|
|
ansible-playbook local_playbook.yml -i localhost_inventory -vvvv -K
|
|
```
|
|
|
|
License
|
|
-------
|
|
|
|
BSD
|
|
|
|
Author Information
|
|
------------------
|
|
|
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|