Skip to content

Commit

Permalink
Idempotence fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Jun 6, 2023
1 parent cec43b6 commit 12e0a28
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,24 @@
- nodejs-install-install

- name: install node.js packages (globally)
community.general.npm:
name: "{{ item.name }}"
version: "{{ item.version | default('latest') }}"
global: true
with_items: "{{ nodejs_npm_packages }}"
tags:
- configuration
- nodejs
- nodejs-npm
- nodejs-npm-install
block:
- name: install node.js packages (specific version)
community.general.npm:
name: "{{ item.name }}"
version: "{{ item.version }}"
global: true
with_items: "{{ nodejs_npm_packages }}"
when: "item.version | default('latest') != 'latest'"

- name: install node.js packages (latest version)
community.general.npm:
name: "{{ item.name }}"
state: "{{ item.version | default('latest') }}"
global: true
with_items: "{{ nodejs_npm_packages }}"
when: "item.version | default('latest') == 'latest'"

0 comments on commit 12e0a28

Please sign in to comment.