Zack Williams | 15c09e7 | 2020-10-14 21:30:57 -0700 | [diff] [blame] | 1 | --- |
| 2 | # php molecule/default/verify.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | - name: Verify |
| 8 | hosts: all |
| 9 | vars: |
| 10 | nginx_static_dir: "/srv/sites/" |
| 11 | tasks: |
| 12 | |
| 13 | # Test PHP-FPM |
| 14 | - name: Create a php test file |
| 15 | copy: |
| 16 | dest: "{{ nginx_static_dir }}/php.example.com/example.php" |
| 17 | mode: 0644 |
| 18 | content: "<?php var_export($_SERVER)?>" |
| 19 | |
| 20 | - name: Retrieve php script output |
| 21 | uri: |
| 22 | url: http://127.0.0.1/example.php |
| 23 | headers: |
| 24 | Host: "php.example.com" |
| 25 | status_code: 200 |
| 26 | return_content: true |
| 27 | register: webpagephp |
| 28 | failed_when: "'SCRIPT_FILENAME' not in webpagephp.content" |
| 29 | |
| 30 | - name: Display php script output |
| 31 | debug: |
| 32 | var: webpagephp |
| 33 | |
| 34 | - name: Delete php test file |
| 35 | file: |
| 36 | path: "{{ nginx_static_dir }}/php.example.com/example.php" |
| 37 | state: absent |