Skip to content

Commit

Permalink
allow passing flags to globall install
Browse files Browse the repository at this point in the history
  • Loading branch information
grzegorznowak committed Apr 20, 2021
1 parent 66b0911 commit 0495021
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,40 @@
install --global {{ item.name }}@{{ item.version }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
when: item.name is defined and item.version is defined
when: item.name is defined and item.version is defined and item.flags is not defined

- name: Install global packages (version, flags and name given)
shell:
cmd: ". /root/.bashrc && {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/npm \
install --global {{ item.flags }} {{ item.name }}@{{ item.version }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
when: item.name is defined and item.version is defined and item.flags is defined

- name: Install global packages (name given in plain string - hopefully)
shell:
cmd: ". /root/.bashrc && {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/npm \
install --global {{ item }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item }}"
loop: "{{ nvm_install_globally }}"
when: item.name is not defined and item.version is not defined
when: item.name is not defined

- name: Install global packages (name given in a dictionary)
- name: Install global packages (just name given in a dictionary)
shell:
cmd: ". /root/.bashrc && {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/npm \
install --global {{ item.name }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
when: item.name is defined and item.version is not defined
when: item.name is defined and item.version is not defined and item.flags is not defined

- name: Install global packages (name and flags given in a dictionary )
shell:
cmd: ". /root/.bashrc && {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/npm \
install --global {{ item.flags }} {{ item.name }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
when: item.name is defined and item.version is not defined and item.flags is defined


### --------------- END ------------- ####

Expand Down

0 comments on commit 0495021

Please sign in to comment.