dev/provisioning/playbook.yml
changeset 4 f55970e41793
parent 2 00e2916104fe
child 18 f2a40bbc27f6
--- a/dev/provisioning/playbook.yml	Wed Jun 24 01:36:46 2015 +0200
+++ b/dev/provisioning/playbook.yml	Mon Oct 05 17:02:10 2015 +0200
@@ -35,8 +35,13 @@
     - name: set .profile
       copy: src=files/.profile dest=/home/vagrant/.profile force=yes
 
+    - name: check yum base last update
+      stat: path=/var/cache/yum/x86_64/6/base/cachecookie
+      register: yum_cache_stat_base
+
     - name: yum update
       yum: name=* update_cache=yes state=latest
+#      when: ansible_date_time.epoch|float - yum_cache_stat_base.stat.mtime > 60*60*12*24
 
     - name: repo ignore outdated postgres base
       ini_file:
@@ -66,6 +71,7 @@
 
     - name: Install Remi repo.
       command: rpm -Uvh --force /tmp/remi-release-6.rpm creates=/etc/yum.repos.d/remi.repo
+      when: remi_repo.stat.exists == False
 
     - name : delete remi rpm
       file: path=/tmp/remi-release-6.rpm state=absent
@@ -80,6 +86,7 @@
 
     - name: Install postgres repo.
       command: rpm -Uvh --force /tmp/pgdg-centos94-9.4-1.noarch.rpm creates=/etc/yum.repos.d/pgdg-94-centos.repo
+      when: postgres_repo.stat.exists == False
 
     - name : delete postgres rpm
       file: path=/tmp/pgdg-centos94-9.4-1.noarch.rpm state=absent
@@ -91,8 +98,13 @@
         option: enabled
         value: 1
 
+    - name: check yum epel last update
+      stat: path=/var/cache/yum/x86_64/6/epel/cachecookie
+      register: yum_cache_stat_epel
+
     - name: yum update after repos
       yum: name=* update_cache=yes state=latest
+#      when: ansible_date_time.epoch|float - yum_cache_stat_epel.stat.mtime > 60*60*12*24
 
     #TODO install alternative packages
     - name: install libs
@@ -110,7 +122,7 @@
         - php56-php-gd
         - php56-php-pgsql
         - java-1.8.0-openjdk
-        - tomcat6
+        - tomcat
 
 
 ## php-fpm config
@@ -208,13 +220,20 @@
 
     - name: set JAVA_HOME
       lineinfile:
-        dest: /etc/tomcat6/tomcat6.conf
-        regexp: '^\#JAVA_HOME='
+        dest: /etc/tomcat/tomcat.conf
+        regexp: '^\#?JAVA_HOME='
         line: JAVA_HOME="/etc/alternatives/jre_1.8.0"
         state: present
 
+    - name: set parseBodyMethods to add POST
+      lineinfile:
+        dest: /etc/tomcat/server.xml
+        regexp: '^\s+\<Connector\s+port=\"8080\"\s+protocol=\"HTTP\/1.1\"\s*$'
+        line: '    <Connector port="8080" protocol="HTTP/1.1" parseBodyMethods="POST,PUT"'
+        state: present
+
 ## Install sesame
-    - stat: path=/var/lib/tomcat6/webapps/openrdf-sesame.war
+    - stat: path=/var/lib/tomcat/webapps/openrdf-sesame.war
       register: sesame_jar
 
     - name: download sesame
@@ -230,7 +249,7 @@
       when: sesame_jar.stat.exists == False
 
     - name: deploy sesame jar
-      shell: cp /tmp/openrdf-sesame-2.8.3-sdk/openrdf-sesame-2.8.3/war/*.war /var/lib/tomcat6/webapps/
+      shell: cp /tmp/openrdf-sesame-2.8.3-sdk/openrdf-sesame-2.8.3/war/*.war /var/lib/tomcat/webapps/
       when: sesame_jar.stat.exists == False
 
     - name: create sesame data folder
@@ -239,13 +258,13 @@
 
     - name: update tomcat config
       lineinfile:
-        dest: /etc/tomcat6/tomcat6.conf
+        dest: /etc/tomcat/tomcat.conf
         line: 'JAVA_OPTS=\"${JAVA_OPTS} -Dinfo.aduna.platform.appdata.basedir=/var/lib/sesame/data\"'
         state: present
       when: sesame_jar.stat.exists == False
 
     - name: restart tomcat
-      service: name=tomcat6 state=restarted enabled=yes
+      service: name=tomcat state=restarted enabled=yes
       when: sesame_jar.stat.exists == False
 
     - name : delete sesame archive
@@ -343,11 +362,6 @@
       service: name=iptables state=restarted
       sudo: true
 
-  handlers:
-    - name: nginx-restart
-      action: service name=nginx update_cache=yes state=latest
-
-
 # - name: install nginx
 #   apt: name=nginx
 #