Commit 4345ca1

bryfry <bryfry@bryfry.com>
2013-10-20 00:48:28
more tasks added
1 parent d89216d
ims-ansible/.my.cnf
@@ -0,0 +1,3 @@
+[client]
+user=root
+password={{ mysql_root_password }}
ims-ansible/ims-playbook.yml
@@ -14,11 +14,15 @@
    jdk_priority: 9001 # over 9000 :P
 
    # sip express router and FHoSS variables
+   oims_dir: "/opt/OpenIMSCore"
    ser_dir: "/opt/OpenIMSCore/ser_ims"
    ser_repo: "http://svn.berlios.de/svnroot/repos/openimscore/ser_ims/trunk"
    fhoss_dir: "/opt/OpenIMSCore/FHoSS"
    fhoss_repo: "http://svn.berlios.de/svnroot/repos/openimscore/FHoSS/trunk"
 
+   # mysql variables
+   mysql_root_password: "arg"
+
   tasks:
   - name: ensure ims dependencies are installed
     apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600 
@@ -48,6 +52,8 @@
     - tmux
     - subversion
     - htop
+    - python-mysqldb
+    - mysql-server
 
   - name: get the oracle jdk from their lame server
     command: wget --quiet --no-cookies --header {{ jdk_header }} {{ jdk_url }} creates={{ jdk_file }}
@@ -69,7 +75,7 @@
     sudo: yes
     with_items:
     - /opt
-    - /opt/OpenIMSCore
+    - "{{ oims_dir }}"
 
   - name: checkout SER code 
     subversion: repo={{ ser_repo }} dest={{ ser_dir }}
@@ -82,8 +88,8 @@
     command: make install-libs all chdir={{ ser_dir }}
     sudo: yes
 
-  - name: make FHoSS
-    command: ant {{ item }} chdir={{ fhoss_dir }}
+  - name: compile and build FHoSS (not idempodent)
+    shell: ant {{ item }} -Dfile.encoding=UTF8 chdir={{ fhoss_dir }}
     sudo: yes
     with_items:
     - compile
@@ -92,3 +98,71 @@
   - name: fix FHoSS directory permissions
     file: path={{ fhoss_dir }}/deploy state=directory recurse=yes mode=0777 
     sudo: yes
+
+  - name: start mysql service
+    service: name=mysql state=started
+
+  - name: copy .my.cnf file with 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
+    with_items:
+    - "{{ ansible_hostname }}"
+    - 127.0.0.1
+    - ::1
+    - localhost
+
+  #TODO import sql here
+
+  - 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
+
+  - name: add openims zone file to bind
+    command: cp /opt/OpenIMSCore/ser_ims/cfg/open-ims.dnszone /etc/bind
+    sudo: yes
+    notify: 
+    - restart bind
+
+  - lineinfile:  # this is triggering every time, need to check why
+      dest=/etc/bind/named.conf.local 
+      regexp="^zone "
+      line='zone "open-ims.test"  { type master; file "/etc/bind/open-ims.dnszone"; };'
+      state=present
+    sudo: yes
+    notify:
+    - restart bind
+
+  - name: make student conf directories
+    file: path={{item}} state=directory
+    sudo: yes
+    with_items:
+    - /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 }
+
+  handlers:
+  - name: restart mysql
+    service: name=mysql state=restarted
+    sudo: yes
+
+  - name: restart bind
+    service: name=bind9 state=restarted
+    sudo: yes
ims-ansible/named.conf.local
@@ -0,0 +1,1 @@
+zone "open-ims.test"  { type master; file "/etc/bind/open-ims.dnszone"; };