Created
November 13, 2014 15:29
-
-
Save t2d/1354e6c91b3106b9723b to your computer and use it in GitHub Desktop.
Playbook for MagicMap in Vagrant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
tasks: | |
- name: Set LC_ALL | |
lineinfile: | |
dest: /etc/environment | |
regexp: ^LC_ALL | |
line: LC_ALL="en_US.utf8" | |
- name: Export language | |
command: /usr/sbin/update-locale LANG={{ locale }} LC_ALL={{ locale }} LANGUAGE={{ locale }} | |
- name: Install necessary libs | |
apt: | |
name: "{{ item }}" | |
state: latest | |
with_items: | |
- language-pack-en | |
- python-psycopg2 | |
- python-software-properties | |
- unzip | |
- xvfb | |
- x11vnc | |
- xfonts-100dpi | |
- xfonts-75dpi | |
- xfonts-scalable | |
- xfonts-cyrillic | |
- ant | |
- name: Generate locale | |
locale_gen: | |
name: en_US.UTF-8 | |
state: present | |
- name: Add the webupd8 APT repository | |
apt_repository: | |
repo: ppa:webupd8team/java | |
state: present | |
- name: Automatically accept the Oracle License | |
shell: echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
- name: Install Oracle Java 7, Tomcat, PostreSQL (be patient) | |
apt: | |
name: "{{ item }}" | |
state: latest | |
update-cache: yes | |
with_items: | |
- oracle-java7-installer | |
- oracle-java7-set-default | |
- tomcat7 | |
- tomcat7-admin | |
- postgresql | |
- name: Configure Tomcat JAVA_HOME | |
lineinfile: | |
dest: /etc/default/tomcat7 | |
regexp: ^JAVA_HOME | |
line: JAVA_HOME=/usr/lib/jvm/java-7-oracle | |
- name: Configure Tomcat JAVA_OPTS | |
lineinfile: | |
dest: /etc/default/tomcat7 | |
regexp: ^JAVA_OPTS | |
line: JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -XX:-UseSplitVerifier" | |
- name: Create Postgres user | |
postgresql_user: | |
name: magicmap | |
password: YVvwYRx78C9c | |
sudo_user: postgres | |
- name: Create DB | |
postgresql_db: | |
name: magicmap | |
owner: magicmap | |
sudo_user: postgres | |
- name: Compile Server | |
command: ant war | |
args: | |
chdir: /vagrant/magicmapserver | |
creates: "{{ magicmap_war }}" | |
- name: Compile Client | |
command: ant dist | |
args: | |
chdir: /vagrant/magicmapclient | |
creates: "{{ magicmap_zip }}" | |
- name: Deploy Tomcat Web App | |
file: | |
src: "{{ magicmap_war }}" | |
dest: /var/lib/tomcat7/webapps/magicmap.war | |
owner: tomcat7 | |
group: tomcat7 | |
mode: 0644 | |
state: link | |
- name: Tomcat Database config | |
copy: | |
src: magicmap.xml | |
dest: /etc/tomcat7/Catalina/localhost/ | |
owner: root | |
group: tomcat7 | |
mode: 0644 | |
- name: Restart Tomcat | |
service: | |
name: tomcat7 | |
state: restarted | |
- name: Create MagicMap folder | |
file: | |
name: "{{ magicmap_path }}" | |
state: directory | |
owner: vagrant | |
group: vagrant | |
mode: 0755 | |
- name: Deploy MagicMap client | |
unarchive: | |
src: "{{ magicmap_zip }}" | |
dest: "{{ magicmap_path }}" | |
owner: vagrant | |
group: vagrant | |
mode: 0644 | |
copy: no | |
- name: Start Xvfb | |
command: Xvfb :1 -screen 0 1024x768x16 | |
args: | |
creates: /tmp/.X1-lock | |
sudo: no | |
async: 999999999999 | |
poll: 0 | |
- name: Copy vncstart files | |
template: | |
src: "{{ item }}" | |
dest: "{{ magicmap_path }}" | |
owner: vagrant | |
group: vagrant | |
mode: 0755 | |
with_items: | |
- vncstart.sh | |
- settings.ini | |
- name: Start MagicMap Client | |
shell: ./vncstart.sh | |
args: | |
chdir: "{{ magicmap_path }}" | |
sudo: no | |
- name: Show VNC port | |
debug: | |
msg: "You can now connect to MagicMap via VNC on localhost:5900" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment