Skip to content

Instantly share code, notes, and snippets.

@rcdilorenzo
Created November 30, 2015 02:33
Show Gist options
  • Save rcdilorenzo/1160c918314af33630aa to your computer and use it in GitHub Desktop.
Save rcdilorenzo/1160c918314af33630aa to your computer and use it in GitHub Desktop.
An ansible playbook script to install elixir on a raspberry pi running Raspbian Wheezy
---
- hosts: all
remote_user: pi
tasks:
- name: check if erlang installed
shell: which erl
register: erl_check
ignore_errors: true
- apt_repository: repo='deb http://packages.erlang-solutions.com/debian wheezy contrib' state=present
when: erl_check|failed
sudo: yes
- shell: wget http://packages.erlang-solutions.com/debian/erlang_solutions.asc
when: erl_check|failed
- shell: sudo apt-key add erlang_solutions.asc && rm erlang_solutions.asc
when: erl_check|failed
- apt: name=erlang-mini update_cache=yes
when: erl_check|failed
sudo: yes
- name: check if elixir installed
shell: elixir -v
register: elixir_check
ignore_errors: true
- name: download kiex for installing elixir
shell: curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | bash -s
when: elixir_check|failed
- name: add kiex to path
lineinfile: dest=~/.bashrc line="PATH=$PATH:~/.kiex/bin"
lineinfile: dest=~/.bashrc line="test -s \"$HOME/.kiex/scripts/kiex\" && source \"$HOME/.kiex/scripts/kiex\""
- name: check if elixir-1.0.5 installed
shell: /home/pi/.kiex/bin/kiex list | grep 1.0.5
register: elixir_version_check
ignore_errors: true
- name: install elixir 1.0.5
shell: /home/pi/.kiex/bin/kiex install 1.0.5
when: elixir_version_check|failed
- name: add kiex source elixir version to path
lineinfile: dest=~/.bashrc line="source $HOME/.kiex/elixirs/elixir-1.0.5.env"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment