diff --git a/README.md b/README.md index c3d35d8..b84625e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ansible Role: nodejs -Install nodejs, npm and yarn packages from the official yarn repositories. Optionally install n from npm repositories for version management. +Install nodejs, npm and yarn packages from the official yarn repositories. Optionally install packages from npm repositories. Tested on: @@ -16,7 +16,9 @@ None. ```yaml node_version: node_20.x -n_enabled: yes +npm_packages: + - n + - pnpm ``` See the role [vars](vars/main.yml) diff --git a/defaults/main.yml b/defaults/main.yml index 31ac946..5abc8f1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,5 @@ --- node_version: node_20.x -n_enabled: yes # https://github.com/tj/n \ No newline at end of file + +npm_packages: + - n # https://github.com/tj/n \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 4818c1c..68a9188 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,8 +11,11 @@ state: present when: ansible_os_family != 'Debian' -- name: Install 'n' package +- name: Install npm requirements ansible.builtin.npm: - name: n + name: "{{ item }}" global: yes - when: n_enabled + state: present + loop: "{{ npm_packages }}" + when: npm_packages is defined +