-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jesus Paz <jeherpabo@gmail.com>
- Loading branch information
Showing
13 changed files
with
101 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,76 @@ | ||
# ansible-nodejs-role | ||
|
||
This is an Ansible role which adds the the NodeSource APT repository and installs Node.js. | ||
This is an Ansible role that adds the NodeSource APT repository and installs Node.js. | ||
|
||
Currently this role supports the following operating systems and releases. | ||
## Supported Operating Systems | ||
|
||
* **Ubuntu 14.04 LTS** (Trusty Tahr) | ||
* **Ubuntu 16.04 LTS** (Xenial Xerus) | ||
Currently, this role supports the following operating systems and releases: | ||
|
||
- **Ubuntu 20.04 LTS** (Focal Fossa) | ||
- **Ubuntu 22.04 LTS** (Jammy Jellyfish) | ||
- **Ubuntu 24.04 LTS** (Noble Numbat) | ||
- **Debian 10** (Buster) | ||
- **Debian 11** (Bullseye) | ||
- **Debian 12** (Bookworm) | ||
|
||
## Usage | ||
|
||
You can either: | ||
### Install and Run Locally | ||
|
||
To install and test this role locally, run: | ||
|
||
```sh | ||
ANSIBLE_ROLES_PATH=../ ansible-playbook playbook.yml --ask-become-pass | ||
``` | ||
|
||
```` | ||
### Install via Ansible Galaxy | ||
* Install the playbook via Ansible Galaxy: | ||
You can install this role directly from Ansible Galaxy: | ||
```text | ||
$ ansible-galaxy install nodesource.node | ||
```sh | ||
ansible-galaxy install nodesource.node | ||
``` | ||
* Install the using [requirements.yml via Ansible Galaxy](http://docs.ansible.com/ansible/galaxy.html#installing-multiple-roles-from-a-file): | ||
Alternatively, use a `requirements.yml` file: | ||
```yml | ||
```yaml | ||
- src: https://github.com/nodesource/ansible-nodejs-role | ||
``` | ||
```text | ||
$ ansible-galaxy install -r requirements.txt | ||
Then install it using: | ||
```sh | ||
ansible-galaxy install -r requirements.yml | ||
``` | ||
## Configure | ||
## Configuration | ||
Then configure it as follows: | ||
Example playbook configuration: | ||
```yaml | ||
- hosts: servers | ||
roles: | ||
- nodesource.node | ||
- nodesource.node | ||
``` | ||
## Role Variables | ||
- `nodejs_nodesource_pin_priority`: Pin-Priority of the NodeSource repository (default: `500`). | ||
- `nodejs_version`: Set Node version (options: `0.10` or `0.12` or `4.6`, default: `4.6`) | ||
- `nodejs_version`: Set the Node.js version (options: `18.x`, `20.x`, `22.x`, `23.x`, default: `22.x`). | ||
## Testing | ||
To test this role using [molecule](https://github.com/metacloud/molecule): | ||
|
||
``` | ||
$ make | ||
$ molecule test | ||
``` | ||
This role is automatically tested using GitHub Actions. To see how the CI/CD pipeline is configured, check the `.github/workflows/ci.yml` file. | ||
## Author | ||
Mark Wolfe <mark@wolfe.id.au> | ||
Originally developed by Mark Wolfe. | ||
Maintained by NodeSource. | ||
## License | ||
This code is Copyright (c) 2014 NodeSource and Mark Wolfe and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included [LICENSE.md](./LICENSE.md) file for more details. | ||
This code is licensed under the MIT License. See the included [LICENSE.md](./LICENSE.md) file for more details. | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ nodejs_supported_versions: | |
- "18.x" | ||
- "20.x" | ||
- "22.x" | ||
- "23.x" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
--- | ||
- hosts: all | ||
- name: Install Node.js using ansible-nodejs-role | ||
hosts: localhost | ||
connection: local | ||
become: true | ||
roles: | ||
- role: ansible-nodejs-role | ||
vars: | ||
nodejs_version: "22.x" | ||
nodejs_nodesource_pin_priority: 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
templates/etc/apt/preferences.d/deb_nodesource_com_node.pref.2
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
deb [arch={{ system_arch.stdout }} signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_{{ nodejs_version }} {{ ansible_distribution_release }} main | ||
deb [arch={{ system_arch.stdout }} signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_{{ nodejs_version }} nodistro main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Package: nodejs | ||
Pin: origin deb.nodesource.com | ||
Pin-Priority: 600 | ||
Pin-Priority: {{ nodejs_nodesource_pin_priority }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
--- | ||
# Node.js version (override if needed) | ||
nodejs_version: "22.x" | ||
# vars file for nodejs |