Skip to content

Commit

Permalink
fix idempotence and remove debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
grzegorznowak committed May 4, 2021
1 parent e19e35a commit 246885f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
8 changes: 0 additions & 8 deletions tasks/_symlink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
register: package_stats_1
when: item.name is defined

- debug:
var: package_stats_1
changed_when: true

- name: Symlink global packages into PATH for specific environments (like cron's) to be able to access them.
file: src="{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}"
dest="/usr/bin/{{ item.name }}" state=link mode="u+rwx,g+rx,o+rx"
Expand All @@ -22,10 +18,6 @@
register: package_stats_2
when: item.name is not defined

- debug:
var: package_stats_2
changed_when: true

- name: Symlink global packages into PATH for specific environments (like cron's) to be able to access them.
file: src="{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item }}"
dest="/usr/bin/{{ item }}" state=link mode="u+rwx,g+rx,o+rx"
Expand Down
10 changes: 5 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,39 +55,39 @@
shell:
cmd: ". /root/.bashrc && {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/npm \
install --global {{ item.name }}@{{ item.version }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/lib/node_modules/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
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 }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/lib/node_modules/{{ 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 }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/lib/node_modules/{{ item }}"
loop: "{{ nvm_install_globally }}"
when: item.name is not defined

- 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 }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/lib/node_modules/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
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 }}"
creates: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/lib/node_modules/{{ item.name }}"
loop: "{{ nvm_install_globally }}"
when: item.name is defined and item.version is not defined and item.flags is defined

Expand Down

0 comments on commit 246885f

Please sign in to comment.