Commit 1be3305c by arbabnazar

adding the tanaguru role

parent 51db66a2
- name: Deploy Tanaguru
hosts: all
sudo: True
gather_facts: True
roles:
- tanaguru
---
tanaguru_prerequisites:
- openjdk-7-jre
- unzip
- libmysql-java
- python-mysqldb
- tomcat6
- libspring-instrument-java
- xvfb
- postfix
- mailutils
locale_setting: "en_US.UTF-8"
tanaguru_download_link: "http://download.tanaguru.org/Tanaguru/tanaguru-3.1.0.i386.tar.gz"
# Go this link to find your desired ESR Firefox
# http://download-origin.cdn.mozilla.net/pub/firefox/releases/24.0esr/linux-x86_64/
# Default is en-US in our example
fixfox_esr_link: "http://download-origin.cdn.mozilla.net/pub/firefox/releases/24.0esr/linux-x86_64/en-US/firefox-24.0esr.tar.bz2"
tanaguru_parameters:
- tanaguru_database: tgdatabase
tanaguru_db_user: tguser
tanaguru_db_password: "tgPassword"
tanaguru_url: "http://localhost:8080/tanaguru/"
tanaguru_admin_email: "admin@example.com"
tg_admin_passwd: "tanaguru15"
\ No newline at end of file
---
- name: restart mysql
service:
name: mysql
state: restarted
- name: restart tomcat6
service:
name: tomcat6
state: restarted
- name: restart xvfb
service:
name: xvfb
pattern: /etc/init.d/xvfb
state: restarted
\ No newline at end of file
---
dependencies:
- mysql
\ No newline at end of file
---
- name: Add the Partner repository
apt_repository:
repo: "{{ item }}"
state: present
with_items:
- "deb http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partner"
- "deb-src http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partner"
- name: Set the Locale
locale_gen:
name: "{{ locale_setting }}"
state: present
- name: Set Postfix options
debconf:
name: postifx
question: "{{ item.question }}"
value: "{{ item.value }} "
vtype: "string"
with_items:
- { question: "postfix/mailname", value: " " }
- { question: "postfix/main_mailer_type", value: "Satellite system" }
- name: Install the TanaGuru Prerequisites
apt:
name: "{{ item }}"
update_cache: yes
state: installed
with_items: tanaguru_prerequisites
- name: Modify the my.cnf file for max_allowed_packet option
lineinfile:
dest: /etc/mysql/my.cnf
regexp: '^max_allowed_packet'
line: 'max_allowed_packet = 64M'
state: present
notify:
- restart mysql
- name: Create a soft link for tomcat jar and mysql connector
file:
dest: "{{ item.dest }}"
src: "{{ item.src }}"
state: link
with_items:
- { src: '/usr/share/java/spring3-instrument-tomcat.jar', dest: '/usr/share/tomcat6/lib/spring3-instrument-tomcat.jar' }
- { src: '/usr/share/java/mysql-connector-java.jar', dest: '/usr/share/tomcat6/lib/mysql-connector-java.jar'}
- name: Copy the xvfb template to /etc/init.d
template:
dest: /etc/init.d/xvfb
src: xvfb.j2
owner: root
group: root
mode: 755
register: xvfb
notify:
- restart xvfb
- name: Configure xvfb to run at startup
command: update-rc.d xvfb defaults
ignore_errors: yes
when: xvfb.changed
- name: Download the latest ESR Firfox
get_url:
url: "{{ fixfox_esr_link }}"
dest: "/tmp/{{ fixfox_esr_link | basename }}"
- name: Unzip the downloaded Firfox zipped file
unarchive:
src: "/tmp/{{ fixfox_esr_link | basename }}"
dest: /opt
copy: no
- name: Download the latest TanaGuru tarball
get_url:
url: "{{ tanaguru_download_link }}"
dest: "/tmp/{{ tanaguru_download_link | basename }}"
- name: Unzip the downloaded Firfox zipped file
unarchive:
src: "/tmp/{{ tanaguru_download_link | basename }}"
dest: "~/"
copy: no
- name: Create MySQL database for TanaGuru
mysql_db:
name: "{{ item.tanaguru_database }}"
state: present
encoding: utf8
collation: utf8_general_ci
with_items: tanaguru_parameters
- name: Create MySQL user for TanaGuru
mysql_user:
name: "{{ item.tanaguru_db_user }}"
password: "{{ item.tanaguru_db_password }}"
host: localhost
priv: "{{ item.tanaguru_database }}.*:ALL"
state: present
with_items: tanaguru_parameters
- name: Install the TanaGuru
shell: >
/bin/echo "yes" | ./install.sh --mysql-tg-user "{{ item.tanaguru_db_user }}" \
--mysql-tg-passwd "{{ item.tanaguru_db_password }}" \
--mysql-tg-db "{{ item.tanaguru_database }}" \
--tanaguru-url "{{ item.tanaguru_url }}" \
--tomcat-webapps /var/lib/tomcat6/webapps \
--tomcat-user tomcat6 \
--tg-admin-email "{{ item.tanaguru_admin_email }}" \
--tg-admin-passwd "{{ item.tg_admin_passwd }}" \
--firefox-esr-path /opt/firefox/firefox \
--display-port ":99.1"
args:
chdir: "~/{{ tanaguru_download_link | basename | regex_replace('.tar.gz$', '') }}"
with_items: tanaguru_parameters
notify:
- restart tomcat6
\ No newline at end of file
#!/bin/sh
set -e
RUN_AS_USER=tomcat6
OPTS=":99 -screen 1 1024x768x24 -nolisten tcp"
XVFB_DIR=/usr/bin
PIDFILE=/var/run/xvfb
case $1 in
start)
start-stop-daemon --chuid $RUN_AS_USER -b --start --exec $XVFB_DIR/Xvfb --make-pidfile --pidfile $PIDFILE -- $OPTS &
;;
stop)
start-stop-daemon --stop --user $RUN_AS_USER --pidfile $PIDFILE
rm -f $PIDFILE
;;
restart)
if start-stop-daemon --test --stop --user $RUN_AS_USER --pidfile $PIDFILE >/dev/null; then
$0 stop
fi;
$0 start
;;
*)
echo "Usage: $0 (start|restart|stop)"
exit 1
;;
esac
exit 0
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment