Skip to content

Add support for newer nodejs versions, in the form of '5.x'. #21

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ Install the playbook via Ansible Galaxy:
```text
$ ansible-galaxy install nodesource.node
```
Or using the `requirements.yml`

```yaml
# install the role from galaxy
- src: nodesource.node
```

Which is imported as follows.

```
ansible-galaxy install -r requirements.yml
```

Then configure it as follows:

Expand All @@ -26,6 +38,7 @@ Then configure it as follows:
## Role Variables

- `nodejs_nodesource_pin_priority`: Pin-Priority of the NodeSource repository (default: `500`).
- `nodejs_version`: Supports 0.10 or 0.12 and 4.x, 5.x and onward, replacing x with your desired minor version.

## Testing

Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# Pin-Priority of NodeSource repository
nodejs_nodesource_pin_priority: 500

# 0.10 or 0.12 or 4.x
# 0.10 or 0.12 and 4.x, 5.x and onward
nodejs_version: "4.2"

2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ galaxy_info:
description: Installs the NodeSource Node.js binary packages
company: NodeSource
license: MIT
min_ansible_version: 1.2
min_ansible_version: 2.0
platforms:
- name: Ubuntu
versions:
Expand Down
7 changes: 6 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
register: apt_https_transport

- name: Install HTTPS transport for APT
apt:
apt:
pkg: apt-transport-https
state: installed
when: not apt_https_transport.stat.exists
Expand All @@ -16,6 +16,11 @@
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present

- name: Check if nodejs_version is 0.x
set_fact:
debian_repo_version: "{{ nodejs_version }}"
when: nodejs_version in zero_versions

- name: Add NodeSource deb repository
apt_repository:
repo: 'deb https://deb.nodesource.com/node_{{ debian_repo_version }} {{ ansible_distribution_release }} main'
Expand Down
3 changes: 2 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# vars file for nodejs
debian_repo_version: "{{ nodejs_version if '4' not in nodejs_version else '4.x' }}"
zero_versions: ['0.10', '0.12']
debian_repo_version: '{{ nodejs_version | regex_replace("^([1-9]+)\.\d+$", "\1.x") }}'