├── LICENSE ├── README.md ├── defaults └── main.yml ├── handlers └── main.yml ├── meta └── main.yml ├── tasks ├── elixir.yml ├── erlang.yml ├── lib.yml └── main.yml ├── templates ├── kerl.sh └── kerlrc ├── test.yml └── vars └── main.yml /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 ohr486 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Elixir 2 | ======== 3 | 4 | An ansible role that install elixir. 5 | 6 | Requirements 7 | ------------ 8 | 9 | Tested on Ansible 1.8.2 or higher. 10 | 11 | sudo to run. 12 | 13 | Role Variables 14 | -------------- 15 | 16 | ``` 17 | - elixir_version: elixir version (v1.6.1, ...) 18 | - erlang_version: erlang version (20.2, ...) 19 | ``` 20 | 21 | Dependencies 22 | ------------ 23 | 24 | none 25 | 26 | Example Playbook 27 | ---------------- 28 | 29 | ``` 30 | - hosts: servers 31 | sudo: yes 32 | roles: 33 | - { role: ohr486.elixir, erlang_version: 20.2, elixir_version: v1.6.2, erl_configure_options: '--enable-hipe --enable-smp-support' } 34 | ``` 35 | 36 | License 37 | ------- 38 | 39 | MIT 40 | 41 | Author Information 42 | ------------------ 43 | 44 | ohr486 45 | 46 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # version 3 | erlang_version: 18.1 4 | elixir_version: v1.1.1 5 | 6 | # erlang/otp configure options 7 | erl_configure_options: '' 8 | 9 | # github url 10 | kerl_bin_github_url: http://github.com/yrashk/kerl/raw/master/kerl 11 | elixir_github_url: https://github.com/elixir-lang/elixir.git 12 | 13 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for ansible-elixir 3 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: ohr486 4 | description: install elixir 5 | license: MIT 6 | min_ansible_version: 2.3 7 | platforms: 8 | - name: EL 9 | versions: 10 | # - all 11 | #- 5 12 | - 6 13 | - 7 14 | #- name: GenericUNIX 15 | # versions: 16 | # - all 17 | # - any 18 | - name: Fedora 19 | versions: 20 | # - all 21 | # - 16 22 | # - 17 23 | # - 18 24 | # - 19 25 | - 20 26 | #- name: SmartOS 27 | # versions: 28 | # - all 29 | # - any 30 | #- name: opensuse 31 | # versions: 32 | # - all 33 | # - 12.1 34 | # - 12.2 35 | # - 12.3 36 | # - 13.1 37 | # - 13.2 38 | - name: Amazon 39 | versions: 40 | - 2014.09.2 41 | #- name: GenericBSD 42 | # versions: 43 | # - all 44 | # - any 45 | #- name: FreeBSD 46 | # versions: 47 | # - all 48 | # - 8.0 49 | # - 8.1 50 | # - 8.2 51 | # - 8.3 52 | # - 8.4 53 | # - 9.0 54 | # - 9.1 55 | # - 9.1 56 | # - 9.2 57 | - name: Ubuntu 58 | versions: 59 | # - all 60 | # - lucid:10.04 61 | # - maverick:10.10 62 | # - natty:11.04 63 | # - oneiric:11.10 64 | # - precise:12.04 65 | # - quantal:12.10 66 | # - raring:13.04 67 | # - saucy:13.10 68 | - trusty:14.04 69 | - vivid:15.04 70 | - wily:15.10 71 | #- name: SLES 72 | # versions: 73 | # - all 74 | # - 10SP3 75 | # - 10SP4 76 | # - 11 77 | # - 11SP1 78 | # - 11SP2 79 | # - 11SP3 80 | #- name: GenericLinux 81 | # versions: 82 | # - all 83 | # - any 84 | #- name: Debian 85 | # versions: 86 | # - all 87 | # - etch:4.x 88 | # - lenny:5.x 89 | # - squeeze:6.x 90 | # - wheezy:7.x 91 | 92 | categories: 93 | #- cloud 94 | #- cloud:ec2 95 | #- cloud:gce 96 | #- cloud:rax 97 | #- clustering 98 | #- database 99 | #- database:nosql 100 | #- database:sql 101 | - development 102 | #- monitoring 103 | #- networking 104 | #- packaging 105 | #- system 106 | #- web 107 | dependencies: [] 108 | # List your role dependencies here, one per line. Only 109 | # dependencies available via galaxy should be listed here. 110 | # Be sure to remove the '[]' above if you add dependencies 111 | # to this list. 112 | -------------------------------------------------------------------------------- /tasks/elixir.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: clone elixir repo 4 | git: repo={{elixir_github_url}} dest={{elixir_build_dir}} version={{elixir_version}} 5 | 6 | - name: compile and install target version elixir 7 | shell: 'source /etc/profile.d/kerl.sh && git checkout refs/tags/{{elixir_version}} && make clean && make && make install' 8 | args: 9 | chdir: "{{elixir_build_dir}}" 10 | executable: /bin/bash 11 | -------------------------------------------------------------------------------- /tasks/erlang.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: get kerl 4 | get_url: url={{kerl_bin_github_url}} dest={{kerl_bin}} mode=0777 5 | 6 | - name: put .kerlrc 7 | template: src=kerlrc dest={{ansible_env['HOME']}}/.kerlrc owner={{ansible_env['USER']}} mode=0744 8 | 9 | - name: remove otp_builds for kerl cleanup command 10 | file: path={{ansible_env['HOME']}}/.kerl/otp_builds state=absent 11 | 12 | - name: remove otp_installations for kerl cleanup command 13 | file: path={{ansible_env['HOME']}}/.kerl/otp_installations state=absent 14 | 15 | - name: update erlang releases 16 | command: "{{kerl_bin}} update releases" 17 | 18 | - name: build erlang 19 | command: "{{kerl_bin}} build {{erlang_version}} {{erlang_version}} creates={{erlang_build_dir}}/{{erlang_version}}" 20 | 21 | - name: install erlang 22 | command: "{{kerl_bin}} install {{erlang_version}} {{erlang_install_dir}}/{{erlang_version}} creates={{erlang_install_dir}}/{{erlang_version}}" 23 | 24 | - name: put activate erlang file 25 | template: src=kerl.sh dest={{profile_dir}}/kerl.sh 26 | 27 | -------------------------------------------------------------------------------- /tasks/lib.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: install dependent packages for red hat derivative distros 4 | yum: name={{item}} state=present 5 | with_items: 6 | - git-core 7 | - curl 8 | - gcc 9 | - glibc 10 | - make 11 | - autoconf 12 | - libselinux-python 13 | - ncurses-devel 14 | - openssl-devel 15 | when: ansible_os_family == 'RedHat' 16 | 17 | - name: install dependent packages for debian derivative distros 18 | apt: name={{item}} state=present update_cache=yes 19 | with_items: 20 | - git-core 21 | - curl 22 | - gcc 23 | - libc6 24 | - make 25 | - autoconf 26 | - libncurses5-dev 27 | - openssl 28 | - libssl-dev 29 | when: ansible_os_family == 'Debian' 30 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # install dependency libs 4 | - include: lib.yml 5 | 6 | # install erlang with kerl 7 | - include: erlang.yml 8 | 9 | # install elixir with github repo 10 | - include: elixir.yml 11 | 12 | -------------------------------------------------------------------------------- /templates/kerl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source {{erlang_install_dir}}/{{erlang_version}}/activate 4 | 5 | -------------------------------------------------------------------------------- /templates/kerlrc: -------------------------------------------------------------------------------- 1 | 2 | KERL_DOWNLOAD_DIR={{erlang_download_dir}} 3 | KERL_BUILD_DIR={{erlang_build_dir}} 4 | KERL_CONFIGURE_OPTIONS="{{erl_configure_options}}" 5 | 6 | -------------------------------------------------------------------------------- /test.yml: -------------------------------------------------------------------------------- 1 | 2 | - hosts: all 3 | vars_files: 4 | - 'defaults/main.yml' 5 | - 'vars/main.yml' 6 | tasks: 7 | - include: 'tasks/main.yml' 8 | 9 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # kerl 3 | kerl_bin: /usr/local/bin/kerl 4 | 5 | # erlang 6 | erlang_download_dir: /tmp/kerl/archives 7 | erlang_build_dir: /tmp/kerl/builds 8 | erlang_install_dir: /usr/lib/kerl/installs 9 | 10 | # elixir 11 | elixir_build_dir: /tmp/elixir 12 | elixir_install_dir: /usr/local/bin 13 | 14 | # etc 15 | profile_dir: /etc/profile.d 16 | 17 | --------------------------------------------------------------------------------