-
-
Save hirshant-sharma/c48d2b94293b6ee2b6f2f06ef4fef169 to your computer and use it in GitHub Desktop.
Example Ansible playbook for installing node.js from source
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
- hosts: all | |
vars: | |
node_version: "0.10.28" | |
tasks: | |
- name: Check for node.js | |
shell: test "$(node -v 2> /dev/null)" = v{{node_version}} | |
register: nodejs_installed | |
ignore_errors: True | |
tags: | |
- nodejs | |
- name: Create temp dir for compiling node.js | |
shell: mktemp -d node.XXXXXXX | |
register: node_tmp_dir | |
when: nodejs_installed|failed | |
tags: | |
- nodejs | |
- name: Download node.js source | |
shell: curl http://nodejs.org/dist/v{{node_version}}/node-v{{node_version}}.tar.gz | tar xz --strip-components=1 chdir={{ node_tmp_dir.stdout }} | |
when: nodejs_installed|failed | |
tags: | |
- nodejs | |
- name: Configure, build and install node.js | |
shell: ./configure && make && make install chdir={{ node_tmp_dir.stdout }} | |
when: nodejs_installed|failed | |
tags: | |
- nodejs | |
- name: Cleanup node.js source | |
shell: rm -rf {{ node_tmp_dir.stdout }} | |
when: nodejs_installed|failed | |
tags: | |
- nodejs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment