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();
?>

While this demonstrates that PHP is installed and working, it isn't very interesting, so before we run our playbook, let's add a few more steps that tie all of the elements of our LAMP stack together.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.15