Skip to content
Snippets Groups Projects
Select Git revision
  • 47bad69b716730309ade9123ff03a3cd8e4c2ff9
  • master default
2 results

main.yml

Blame
  • main.yml 1.95 KiB
    ---
    # tasks file for php-fpm
    
    - name: Assertions
      assert:
        that:
            - ansible_os_family in php_fpm_service
            - ansible_os_family in php_fpm_www_user
            - ansible_os_family in php_fpm_conf
            - ansible_os_family in php_fpm_listen_socket
            - ansible_os_family in php_fpm_validate_config
            - ansible_os_family in php_fpm_pools_dir
            - ansible_os_family in php_fpm_user
            - ansible_distribution_release in ['precise', 'wheezy', 'jessie', 'trusty'] or ansible_distribution_version in ['6.0']
            - php_fpm_global_config is iterable
            - php_fpm_www_pool_config is iterable
    
    - name: APT install
      when: ansible_pkg_mgr == 'apt'
      apt:
          name: php5-fpm
          state: present
          update_cache: yes
          cache_valid_time: 3600
    
    - name: pkg install
      when: ansible_pkg_mgr == 'openbsd_pkg'
      openbsd_pkg:
          name: php-fastcgi%5.6
          state: present
    
    - name: Create pools directory
      file:
          path: '{{ php_fpm_pools_dir[ansible_os_family] }}'
          owner: root
          group: 0
          mode: 0o0755
          state: directory
    
    - name: Copy pool templates
      with_fileglob:
      - '{{ role_path }}/templates/php-fpm/pools/*.conf'
      - '{{ playbook_dir }}/templates/php-fpm/pools/*.conf'
      template:
          src: '{{ item }}'
          dest: '{{ php_fpm_pools_dir[ansible_os_family] }}/{{ item|basename }}'
          owner: root
          group: 0
          mode: 0o0644
      notify:
      - Restart PHP-FPM
    
    - name: Global config
      template:
          dest: '{{ php_fpm_conf[ansible_os_family] }}'
          src: php-fpm.conf
          owner: root
          group: 0
          mode: 0o0644
      notify:
          - Restart PHP-FPM
    
    - name: Verify config
      command: '{{ php_fpm_validate_config[ansible_os_family] }}'
      changed_when: False
    
    - name: Enable service
      service:
          name: '{{ php_fpm_service[ansible_os_family] }}'
          state: started