]> arthur.barton.de Git - AnsibleRoles.git/blobdiff - roles/apache2-php5/tasks/main.yml
Apt module: Update "state=installed" to "state=present"
[AnsibleRoles.git] / roles / apache2-php5 / tasks / main.yml
index d39e17f39d7d24bc758bb9052c867647a1f68c90..7bcd63f8f2c39aa318d831592ff12f256a13a554 100644 (file)
@@ -1,27 +1,58 @@
 ---
 # apache2-php5 tasks
 
+- name: check if "php5-apcu" package exists
+  tags:
+    - apache
+    - packages
+  shell: apt-cache search php5-apcu | grep "^php5-apcu -" >/dev/null
+  check_mode: no
+  register: php5_apcu_is_available
+  failed_when: php5_apcu_is_available.rc > 1
+  changed_when: no
+
 - name: install packages for Apache 2 with PHP 5
   tags:
     - apache
     - packages
   apt: >
-    state=installed
+    state=present
     name={{ item }}
   with_items:
     - libapache2-mod-php5
-    - php-apc
     - php5
     - php5-cli
     - php5-mysql
   notify:
     - restart "apache2"
 
-- name: ensure service "apache2" is enabled and running
+- name: install "php5-apcu" cache
+  tags:
+    - apache
+    - packages
+  apt: >
+    state=present
+    name=php5-apcu
+  notify:
+    - restart "apache2"
+  when: php5_apcu_is_available.rc == 0
+
+- name: install "php-apc" cache
+  tags:
+    - apache
+    - packages
+  apt: >
+    state=present
+    name=php-apc
+  notify:
+    - restart "apache2"
+  when: php5_apcu_is_available.rc != 0
+
+- name: ensure service "apache2" is enabled and started
   tags:
     - apache
     - services
   service: >
     enabled=yes
     name=apache2
-    state=running
+    state=started