--- - name: "Installing prerequisites Debian" apt: name={{ item }} update_cache=yes sudo: true with_items: - libxml2-dev - libxslt1-dev - python-lxml - libcrack2-dev - csstidy - ldap-utils - python-cracklib - git - apache2-dev when: ansible_os_family == "Debian" - name: "Installing prerequisites Redhat" yum: name={{ item }} state=latest sudo: true with_items: - libxml2-devel - libxslt-devel - python-lxml - openldap-clients - cracklib-python - git - gcc - gcc-c++ - gcc-gfortran - freetype-devel - libpng-devel - lapack-devel - blas-devel - libffi-devel when: ansible_os_family == "RedHat" - name: Install the latest pip shell: easy_install pip when: ansible_os_family == "RedHat" - name: "Getting Karaage from Github" git: repo="https://github.com/monash-merc/karaage.git" dest="/root/karaage3.1.7" force=yes sudo: true - name: "Create log directory, start aoacge will have errors without it" file: dest=/etc/apache2/logs state=directory sudo: true - name: "Installing Karaage Dependencies" pip: name={{ item }} sudo: true with_items: - six - MySQL-python - slimit - ply - cython - django-celery - mod_wsgi - name: "Restrict Django version to 1.7.8" sudo: true replace: dest=/root/karaage3.1.7/setup.py regexp="Django >= 1.7" replace="Django == 1.7.8" - name: "Installing Karaage from source" shell: "env python setup.py install" args: chdir: /root/karaage3.1.7 creates: /root/karaage3.1.7/build/bdist.linux-x86_64 sudo: true - name: "Templating Karaage settings" template: src=settings.py.j2 dest=/etc/karaage3/settings.py owner=root group={{ apache_user }} mode=0640 sudo: true - name: "Creating karaage3 in /var directories log, lib " file: path={{ item }} state=directory owner=root group={{ apache_user }} mode=0775 with_items: - /var/log/karaage3 - /var/lib/karaage3 - /var/cache/karaage3 sudo: true - name: "Change permissions for /var/www" file: path=/var/www state=directory owner=root group={{ apache_user }} mode=0775 sudo: true - name: "enabling Karaage configuration" shell: a2enconf karaage3-wsgi sudo: true when: ansible_os_family == "Debian" - name: "enabling Karaage configuration" shell: cp -rvpf /root/karaage3.1.7/conf/karaage3-wsgi.conf /etc/httpd/conf.d/karaage3-wsgi.conf when: ansible_os_family == "RedHat" - name: "Installing other packages Debian" apt: name={{ item }} update_cache=yes with_items: - python-kgusage - karaage-cluster-tools - karaage3-celery sudo: true when: ansible_os_family == "Debian" - name: Downloading other packages RedHat git: repo={{ item.repo }} dest={{ item.dest }} with_items: - { repo : 'https://github.com/numpy/numpy.git', dest : '/root/numpy' } - { repo : 'https://github.com/matplotlib/matplotlib.git', dest : '/root/matplotlib' } - { repo : 'https://github.com/Karaage-Cluster/karaage-software.git', dest : '/root/karaage-software' } - { repo : 'https://github.com/Karaage-Cluster/karaage-usage.git', dest : '/root/karaage-usage' } - { repo : 'https://github.com/Karaage-Cluster/karaage-applications.git', dest : '/root/karaage-applications' } - { repo : 'https://github.com/Karaage-Cluster/karaage-cluster-tools.git', dest : '/root/karaage-cluster-tools' } sudo: true when: ansible_os_family == "RedHat" - args: chdir: "/root/{{ item }}" creates: "/root/{{ item }}/build/bdist.linux-x86_64" name: "Installing other packages RedHat" sudo: true shell: "env python setup.py install" when: ansible_os_family == "RedHat" with_items: - numpy - matplotlib - karaage-applications - karaage-software - karaage-usage - karaage-cluster-tools - name: "Set Secret Key" lineinfile: dest=/etc/karaage3/settings.py regexp="SECRET_KEY = ''" line="SECRET_KEY = '{{ karaageSecretKey }}'" state=present sudo: true - # TODO: Fix it name: "Check DB tables has been created or not" shell: ls /root/.karaage_db_init ignore_errors: true sudo: true register: karaage_db_init - name: "Enable wsgi config" file: src=/etc/apache2/mods-available/wsgi.conf path=/etc/apache2/mods-enabled/wsgi.conf state=link sudo: true - name: "Enable wsgi load" file: src=/etc/apache2/mods-available/wsgi.load path=/etc/apache2/mods-enabled/wsgi.load state=link sudo: true - name: " Create DB tables" shell: kg-manage migrate && touch /root/.karaage_db_init sudo: true when: karaage_db_init is not defined - name: "Restarting Celery" service: name=karaage3-celery state=restarted sudo: true when: ansible_os_family == "Debian" - name: "Reloading apache" service: name=apache2 state=reloaded sudo: true when: ansible_os_family == "Debian" - name: "Reloading apache" service: name=httpd state=reloaded sudo: true when: ansible_os_family == "RedHat"