The phpinfo file

As with the Apache installation, we can add the option to upload a test file, in this case, a simple PHP file that calls the php_info function. This displays information about our PHP installation. The task to upload this file looks like the following:

- name: copy the test PHP page to the document root  copy:    src: "info.php"    dest: "{{ document_root }}/info.php"    mode: "0755"    owner: "{{ users.0.name }}"    group: "{{ apache_group }}"  when: php_info == true

As you can see, it is only being called when the following is set in roles/php/default/main.yml:

php_info: true

The file we are copying to the host from our Ansible controller can be found in roles/php/files/info.php, and it contains the following three lines:

<?php phpinfo(); ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.