From 9335dbfbe6ae48e2114ff28dba62a367b9951acc Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 13 Sep 2016 17:46:44 +0200 Subject: [PATCH] library/roles/octave: Role that installs octave from the Ubuntu PPA. --- octave/defaults/main.yml | 7 +++++++ octave/tasks/main.yml | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 octave/defaults/main.yml create mode 100644 octave/tasks/main.yml diff --git a/octave/defaults/main.yml b/octave/defaults/main.yml new file mode 100644 index 00000000..098bfb29 --- /dev/null +++ b/octave/defaults/main.yml @@ -0,0 +1,7 @@ +--- +octave_install: False +octave_repo: 'ppa:octave/stable' +octave_pkg_state: latest +octave_pkgs: + - octave + diff --git a/octave/tasks/main.yml b/octave/tasks/main.yml new file mode 100644 index 00000000..8af3da58 --- /dev/null +++ b/octave/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- block: + - name: Install the octave repository + apt_repository: repo={{ octave_repo }} update_cache=yes + + - name: Install the octave packages + apt: pkg={{ item }} state={{ octave_pkg_state }} update_cache=yes cache_valid_time=3600 + with_items: '{{ octave_pkgs }}' + + tags: octave + when: octave_install + + +- block: + - name: Remove the octave repository + apt_repository: repo={{ octave_repo }} state=absent + + - name: Remove the octave packages + apt: pkg={{ item }} state=absent + with_items: '{{ octave_pkgs }}' + + tags: octave + when: not octave_install