Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new role variables to allow setting custom scala+sbt install folders #4

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ An Ansible role for installing Scala.

- `scala_version` - Scala version
- `scala_sbt_version` - SBT version
- `scala_src_dir` - the folder containing the installer archive (default: `/usr/local/src`)
- `scala_usr_dir` - the parent folder for the symlinks to the scala binaries (default: `/usr/local/bin`)
- `scala_usr_orig_dir` - the parent folder for the installed scala folder (default: `/opt`)

## Testing
Tests are done using [molecule](http://molecule.readthedocs.io/). To run the test suite, install molecule and its dependencies and run ` molecule test` from the folder containing molecule.yml. To add additional tests, add a [testinfra](http://testinfra.readthedocs.org/) python script in the [tests](./tests/) directory, or add a function to [test_scala.py](./tests/test_scala.py). Information about available Testinfra modules is available [here](http://testinfra.readthedocs.io/en/latest/modules.html).
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
scala_version: "2.11.1"
scala_sbt_version: "0.13.6"
scala_src_dir: /usr/local/src
scala_usr_dir: /usr/local/bin
scala_usr_orig_dir: /opt
15 changes: 8 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
- name: Download Scala
get_url: url=http://www.scala-lang.org/files/archive/scala-{{ scala_version }}.tgz
dest=/usr/local/src/scala-{{ scala_version }}.tgz
dest={{ scala_src_dir }}/scala-{{ scala_version }}.tgz

- name: Extract and install Scala
unarchive: src=/usr/local/src/scala-{{ scala_version }}.tgz
dest=/opt
unarchive: src={{ scala_src_dir }}/scala-{{ scala_version }}.tgz
dest={{ scala_usr_orig_dir }}
copy=no
creates={{ scala_usr_orig_dir }}/scala-{{ scala_version }}

- name: Symlink Scala into /usr/local/bin
file: src=/opt/scala-{{ scala_version }}/bin/{{ item }}
dest=/usr/local/bin/{{ item }}
file: src={{ scala_usr_orig_dir }}/scala-{{ scala_version }}/bin/{{ item }}
dest={{ scala_usr_dir }}/{{ item }}
state=link
with_items:
- fsc
Expand All @@ -21,8 +22,8 @@

- name: Download SBT package
get_url: url=https://dl.bintray.com/sbt/debian/sbt-{{ scala_sbt_version }}.deb
dest=/usr/local/src/sbt-{{ scala_sbt_version }}.deb
dest={{ scala_src_dir }}/sbt-{{ scala_sbt_version }}.deb

- name: Install SBT
apt: deb=/usr/local/src/sbt-{{ scala_sbt_version }}.deb
apt: deb={{ scala_src_dir }}/sbt-{{ scala_sbt_version }}.deb
state=installed