I have created a ansible role for installing RT. The role performs a
fully automatic installation of RT for our purposes. The complete role
is not generic enough to distribute in full (Debian-specific), but the
role contains some ansible tasks which (somewhat hackishly) tries to
resolve RT dependencies. First by deducing suitable Debian packages, and
then be falling back to installing missing perl modules from CPAN.
Hopefully you can get some ideas on how to automate your installation
from this.
----- snip - snip -------------------------------------------------
-
name: Try to deduce and install APT packages from RTβs dependency test
shell: |
make testdeps |
perl -lne βprint if (/dependencies:/ β¦ eof())β |
grep β.MISSINGβ |
perl -pe βs/\s(\S+)\s.*MISSING/lc βlib$1-perlβ/eβ |
sed βs/::/-/gβ |
while read x; do if apt-cache show $x >/dev/null 2>&1; then echo $x; fi; done
args:
chdir: β{{ rt_src_path }}/rt-{{ rt_version }}β
register: rt_dep_pkgs
tags:- rt_dep
-
name: Register missing packages as a variable/fact
set_fact:
rt_missing_pkgs: β{{ rt_dep_pkgs.stdout.split() }}β
tags:- rt_dep
-
name: Install missing Perl dependencies as Debian packages
apt:
name: β{{ item }}β
state: present
with_items: β{{ rt_missing_pkgs }}β
ignore_errors: true
tags:- rt_dep
-
name: Detect missing packages
shell: |
make testdeps |
grep β.MISSINGβ |
perl -ne β($module, $version) = m/\s(\S+)\s*(?:>=)?\s*(\d+(.\d+)+)?\s*.*MISSING/; printf $module.($version ? β~$version\nβ:"\n")β |
sort | uniq
args:
chdir: β{{ rt_src_path }}/rt-{{ rt_version }}β
register: rt_cpanm_pkgs
tags:- rt_dep
-
name: Register missing packages as a variable/fact
set_fact:
rt_cpanm_missing_pkgs: β{{ rt_cpanm_pkgs.stdout.split() }}β
tags:- rt_dep
-
name: Install missing Perl dependencies as CPAN packages
cpanm:
name: β{{ item }}β
with_items: β{{ rt_cpanm_missing_pkgs }}β
ignore_errors: true
tags:- rt_dep
-
name: Finally, test remaining RT dependencies
shell: |
make testdeps
args:
chdir: β{{ rt_src_path }}/rt-{{ rt_version }}β
register: rt_testdeps
changed_when: False
failed_when: False
tags:- rt_dep
-
name: Install RT
shell: |
make install
args:
chdir: β{{ rt_src_path }}/rt-{{ rt_version }}β
creates: β{{ rt_install_path }}/sbinβ
----- snip - snip -------------------------------------------------