--- - block: - name: Install the scala sbt repository key apt_key: keyserver='keyserver.ubuntu.com' id={{ scala_sbt_repo_key }} state=present - name: Install the scala sbt repository configuration apt_repository: repo={{ scala_sbt_repo }} state=present update_cache=yes filename=scala-sbt.list - name: Install the scala sbt packages apt: pkg={{ scala_sbt_pkgs }} state=present update_cache=yes cache_valid_time=3600 when: scala_sbt_install tags: [ 'scala', 'sbt', 'scala_sbt' ] - block: - name: Remove the scala sbt packages apt: pkg={{ scala_sbt_pkgs }} state=absent - name: Remove the scala sbt repository configuration apt_repository: repo={{ scala_sbt_repo }} state=absent update_cache=yes file=scala-sbt.list - name: Remove the scala sbt repository key apt_key: keyserver='keyserver.ubuntu.com' id={{ scala_sbt_repo_key }} state=absent when: not scala_sbt_install tags: [ 'scala', 'sbt', 'scala_sbt' ]