Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Pin-Priority of NodeSource repository
nodejs_nodesource_pin_priority: 500

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be wise to pin this to 4.x rather than 5.x because those who use Ansible are more likely to be LTS type users and v5.x is only going to last a max of 8 months so we'll be updating this config pretty soon.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

You're absolutely right, will fix it.

Thank you.

On Wed, Nov 18, 2015 at 3:34 AM, Rod Vagg notifications@github.com wrote:

In defaults/main.yml
#21 (comment)
:

@@ -2,5 +2,5 @@

Pin-Priority of NodeSource repository

nodejs_nodesource_pin_priority: 500

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

I think it might be wise to pin this to 4.x rather than 5.x because
those who use Ansible are more likely to be LTS type users and v5.x is only
going to last a max of 8 months so we'll be updating this config pretty
soon.


Reply to this email directly or view it on GitHub
https://github.com/nodesource/ansible-nodejs-role/pull/21/files#r45156477
.

Manuel Tiago Pereira

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") }}'