Created
May 9, 2014 12:50
-
-
Save leihog/12c5f4560c9e56ee6520 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