diff --git a/unifi.init b/unifi.init index 57b6b97..769d1e2 100755 --- a/unifi.init +++ b/unifi.init @@ -12,7 +12,7 @@ MAINCLASS="com.ubnt.ace.Launcher" PIDFILE="/var/run/${NAME}/${NAME}.pid" PATH=/bin:/usr/bin:/sbin:/usr/sbin -JAVA_HOME=/usr/lib/jvm/java-6-openjdk +JAVA_HOME="{{ java_home }}" # JSVC - for running java apps as services JSVC=`which jsvc` #JSVC_OPTS="-debug" @@ -20,7 +20,6 @@ JSVC_OPTS="${JSVC_OPTS}\ -home ${JAVA_HOME} \ -cp /usr/share/java/commons-daemon.jar:${BASEDIR}/lib/ace.jar \ -pidfile ${PIDFILE} \ - -procname ${NAME} \ -outfile SYSLOG \ -errfile SYSLOG \ -Djava.awt.headless=true -Xmx1024M" diff --git a/unifi.play b/unifi.play index 87fa5a6..6412905 100644 --- a/unifi.play +++ b/unifi.play @@ -2,16 +2,17 @@ - hosts: unifi_controllers vars: - - unifi_zip_file: UniFi.zip - - unifi_zip_dest: /usr/local/src/UniFi.zip + - unifi_zip_file: UniFi-2.4.6.zip + - unifi_zip_dest: /usr/local/src/UniFi-2.4.6.zip - unifi_prefix: /opt - unifi_uid: unifi - unifi_gid: unifi - ntp_server: pool.ntp.org + - java_home: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 sudo: yes tasks: - - name: check os is ok + - name: abort if os is not suitable when: ansible_os_family != "RedHat" fail: "msg={{ansible_os_family}} is not supported by this playbook" @@ -19,12 +20,12 @@ when: ansible_os_family == "RedHat" yum: name={{ item }} state=present with_items: - - java-1.7.0-openjdk + - java-1.6.0-openjdk - jakarta-commons-daemon-jsvc - mongodb-server - - name: ensure mongod is running - service: name=mongod enabled=yes state=started + - name: no need for the standard mongod service + service: name=mongod enabled=no state=stopped - name: setup unifi group group: name={{ unifi_gid }} system=yes state=present @@ -36,7 +37,7 @@ copy: src={{ unifi_zip_file }} dest={{ unifi_zip_dest }} - name: extract unifi - command: /usr/bin/unzip -f -o {{ unifi_zip_dest }} -d {{ unifi_prefix }} + command: /usr/bin/unzip -o {{ unifi_zip_dest }} -d {{ unifi_prefix }} creates=/opt/UniFi - name: fix permissions command: /bin/chown -R {{ unifi_uid }}:{{ unifi_gid }} {{ unifi_prefix }}/UniFi @@ -48,7 +49,7 @@ template: src=config.properties dest={{ unifi_prefix }}/UniFi/data/config.properties owner={{ unifi_uid }} group={{ unifi_gid }} - name: install init script - copy: src=unifi.init dest=/etc/init.d/unifi owner=root group=root mode=755 + template: src=unifi.init dest=/etc/init.d/unifi owner=root group=root mode=755 - name: start unifi service service: name=unifi enabled=yes state=started