-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
substantially simplify the way symlinking back to global paths work
- Loading branch information
1 parent
246885f
commit c1729dd
Showing
2 changed files
with
14 additions
and
21 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,24 +1,18 @@ | ||
--- | ||
|
||
# making sure the package's bin actually exists | ||
- name: "Stats over {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}" | ||
stat: | ||
path: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item.name }}" | ||
register: package_stats_1 | ||
when: item.name is defined | ||
- name: Find all the binaries | ||
find: | ||
paths: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin" | ||
patterns: '*' | ||
follow: true | ||
file_type: any | ||
register: find_result | ||
|
||
- 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" | ||
when: item.name is defined and package_stats_1.stat.exists | ||
|
||
- name: "Stats over {{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item }}" | ||
stat: | ||
path: "{{ nvm_dir }}/versions/node/v{{ nvm_node_version }}/bin/{{ item }}" | ||
register: package_stats_2 | ||
when: item.name is not defined | ||
|
||
- 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" | ||
when: item.name is not defined and package_stats_2.stat.exists | ||
file: | ||
src: "{{ item.path }}" | ||
dest: "/usr/bin/{{ item.path | basename }}" | ||
state: link | ||
mode: "u+rwx,g+rx,o+rx" | ||
loop: "{{ find_result.files }}" | ||
changed_when: true |
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