Commit d2a18a8

bryfry <bryon.fryer@gmail.com>
2013-10-20 12:20:27
working mysql and full tmux demo :)
1 parent 4345ca1
ims-ansible/IMS_Install.sh → ims-ansible/files/IMS_Install.sh
File renamed without changes
ims-ansible/files/imsCore.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+#tmux start-server
+#tmux new-session -t 0
+
+tmux has-session -t imsCore                        # determine if this is a reload
+OUT=$?
+if [ $OUT -eq 0 ]; # true = 0
+then
+    tmux detach-client -s imsCore
+#   tmux kill-pane -a -t imsCore:core.4            # reload - kill all existing except pane 4
+#   tmux kill-window -t imsCore:core
+    tmux kill-session -t imsCore
+    tmux new-session -d -s imsCore -x 160 -y 48    # fresh launch :)
+#   tmux rename-window -t imsCore:core garbage     # prepare the old core for destruction
+    tmux new-window -n core -k
+else
+    tmux start-server
+    tmux new-session -d -s imsCore -x 160 -y 48    # fresh launch :)
+    tmux new-window -n core -k
+fi
+
+# Launch all the Core Daemons
+tmux splitw -h -t imsCore:core.0 "cd /opt/OpenIMSCore; sleep 1;bash -c ./pcscf.sh"  
+tmux splitw -h -t imsCore:core.1 "cd /opt/OpenIMSCore; sleep 1; bash -c ./icscf.sh"
+tmux splitw -h -t imsCore:core.2 "cd /opt/OpenIMSCore; sleep 1; bash -c ./scscf.sh"
+tmux splitw -h -t imsCore:core.3 "cd /opt/OpenIMSCore/FHoSS/deploy; sleep 1; bash -c ./startup.sh"
+# tmux splitw -h -t imsCore:core.4 "cd; bash"
+
+# Cleanup all the mess we made of the panes/windows
+tmux kill-pane -t imsCore:core.0
+tmux select-window -t imsCore:core
+tmux select-layout -t imsCore:core main-horizontal      #tiled
+tmux swap-window -s imsCore:core -t imsCore:0
+tmux rename-window -t imsCore:1 mgmt
+tmux attach
+# tmux kill-window -t garbage
+
ims-ansible/files/kill_tmux.desktop
@@ -0,0 +1,12 @@
+#!/usr/bin/env xdg-open
+
+[Desktop Entry]
+Version=1.0
+Type=Application
+Terminal=false
+Icon[en_US]=/usr/share/icons/HighContrast/scalable/actions/view-sort-ascending.svg
+Exec=tmux kill-server
+Categories=IMS
+Name[en_US]=Stop IMS Core
+Name=Kill Tmux
+Icon=/usr/share/icons/HighContrast/scalable/actions/view-sort-ascending.svg
ims-ansible/.my.cnf → ims-ansible/files/my.cnf
File renamed without changes
ims-ansible/files/StartIMScore.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Terminal=false
+Icon=/usr/share/icons/HighContrast/scalable/actions/view-sort-descending.svg
+Name[en_US]=Start IMS Core
+Name=StartIMSCore
+Categories=IMS
+Comment=Start the IMS core;
+Exec=gnome-terminal --geometry=80x48-0+100 -x bash -c "/etc/studentconf/openimscore/imsCore.sh; tmux -L default attach-session -t imsCore"
ims-ansible/ims-playbook.yml
@@ -69,6 +69,9 @@
     - { java_bin: "/usr/bin/java", java_bin_name: "java" }
     - { java_bin: "/usr/bin/javac", java_bin_name: "javac" }
     - { java_bin: "/usr/bin/javaws", java_bin_name: "javaws" }
+  - name: link java for programs that arent smart enough to know where it is (FHoSS)
+    file: dest=/bin/java src=/usr/bin/java state=link 
+    sudo: yes
   
   - name: ensure IMS directories exist
     file: path={{ item }} state=directory
@@ -102,29 +105,55 @@
   - name: start mysql service
     service: name=mysql state=started
 
-  - name: copy .my.cnf file with root password credentials
+  - name: ensure mysql .my.cnf file deployed (root password credentials)
     template: src=.my.cnf dest=/root/.my.cnf owner=root mode=0600
     sudo: yes
     notify:
     - restart mysql
 
   - name: update mysql root password for all root accounts
-    mysql_user: login_user=root login_password={{ mysql_root_password }} name=student host={{ item }} password={{ mysql_root_password }} state=present priv=*.*:ALL,GRANT
+    mysql_user: 
+      host={{ item }}
+      login_user=root
+      login_password={{ mysql_root_password }} 
+      name=student 
+      password={{ mysql_root_password }} 
+      state=present 
+      priv=*.*:ALL,GRANT
+    sudo: yes
     with_items:
     - "{{ ansible_hostname }}"
     - 127.0.0.1
     - ::1
     - localhost
 
-  #TODO import sql here
+  #- name: import sql databases
+  #  mysql_db: 
+  #    login_user=root
+  #    login_password={{ mysql_root_password }}
+  #    login_host=localhost
+  #    state=import 
+  #    name={{ item.db }} 
+  #    target={{ item.sql }}
+  #  with_items:
+  #  - { db: icscf, sql: "{{ ser_dir }}/cfg/icscf.sql" }
+  #  - { db: hss_db, sql: "{{ fhoss_dir }}/scripts/hss_db.sql" }
+  #  - { db: hss_db, sql: "{{ fhoss_dir }}/scripts/userdata.sql" }
+
+  - name: give up on the ansible module and just pipe sql into mysql
+    shell: mysql -u student --password={{ mysql_root_password }} < {{ item }}
+    with_items:
+    - "{{ ser_dir }}/cfg/icscf.sql"
+    - "{{ fhoss_dir }}/scripts/hss_db.sql"
+    - "{{ fhoss_dir }}/scripts/userdata.sql"
 
   - name: grab all cfg xml and sh files into OpenIMSCore
     shell: cp {{ item }} . chdir={{ oims_dir }}
     sudo: yes
     with_items:
-    - /opt/OpenIMSCore/ser_ims/cfg/*.cfg
-    - /opt/OpenIMSCore/ser_ims/cfg/*.xml
-    - /opt/OpenIMSCore/ser_ims/cfg/*.sh
+    - "{{ ser_dir }}/cfg/*.cfg"
+    - "{{ ser_dir }}/cfg/*.xml"
+    - "{{ ser_dir }}/cfg/*.sh"
 
   - name: add openims zone file to bind
     command: cp /opt/OpenIMSCore/ser_ims/cfg/open-ims.dnszone /etc/bind
@@ -132,7 +161,7 @@
     notify: 
     - restart bind
 
-  - lineinfile:  # this is triggering every time, need to check why
+  - lineinfile:  
       dest=/etc/bind/named.conf.local 
       regexp="^zone "
       line='zone "open-ims.test"  { type master; file "/etc/bind/open-ims.dnszone"; };'
@@ -148,15 +177,13 @@
     - /etc/studentconf
     - /etc/studentconf/openimscore 
 
-  # TODO file permsisions need fixed here
-  # these source files dont exist yet...
-  #- name: copy launchers and scripts into student folder
-  #  command: cp {{ item.source }} {{ item.dest }} 
-  #  sudo: yes
-  #  with_items:
-  #  - { source: /home/student/Desktop/MINT/OpenIMS/imsCore.sh, dest: /etc/studentconf/openimscore }
-  #  - { source: /home/student/Desktop/MINT/OpenIMS/kill_tmux.desktop, dest: /usr/share/applications }
-  #  - { source: /home/student/Desktop/MINT/OpenIMS/StartIMScore.desktop, dest: /usr/share/applications }
+  - name: copy launchers and scripts into student folder
+    copy: src={{ item.src}} dest={{ item.dest }} 
+    sudo: yes
+    with_items:
+    - { src: files/imsCore.sh, dest: /etc/studentconf/openimscore }
+    - { src: files/kill_tmux.desktop, dest: /usr/share/applications }
+    - { src: files/StartIMScore.desktop, dest: /usr/share/applications }
 
   handlers:
   - name: restart mysql
ims-ansible/named.conf.local
@@ -1,1 +0,0 @@
-zone "open-ims.test"  { type master; file "/etc/bind/open-ims.dnszone"; };