thorian93.php
Ansible Role: PHP
This role installs PHP on servers running Debian/Ubuntu, RHEL/CentOS, and Fedora.
Known Issues
None.
Requirements
No special requirements; however, this role needs root access. You can run it in a playbook with become: yes
, or use it like this:
- hosts: foobar
roles:
- role: thorian93.php
become: yes
Role Variables
Here are the available variables with their default values (see defaults/main.yml
):
php_major_version: 7
Set the major version of PHP.
php_minor_version: 4
Set the minor version of PHP.
php_third_party_enabled: 'false'
Choose whether to use a third-party repository. Check the vars/
folder for details on repositories. This role may fail if the third-party repository is not enabled.
php_ppa_enabled: 'false'
php_ppa: "ppa:ondrej/php"
Choose whether to use an Ubuntu PPA, and if so, which one. The default is the well-known Sury repository. This role may fail if the PPA is not enabled.
php_enabled_modules:
- curl
Decide which PHP module you want to install.
php_config_options: []
Add any additional PHP configuration options.
Dependencies
- Webserver: This role helps detect the web server.
OS Compatibility
This role checks if the operating system is supported by looking at a variable named <role-name>_stable_os
. You can find this variable in defaults/main.yml
:
role_stable_os:
- Debian 10
- Ubuntu 18
- CentOS 7
- Fedora 30
If the system's distribution and version don't match, the role will fail. To use it, add the correct distribution and version to that variable. Please test any new combination first!
Thanks to HarryHarcourt for this idea!
Example Playbook
Here’s an example of how to run the role:
---
- name: "Run role."
hosts: all
become: yes
roles:
- ansible-role-php
Contributing
Feel free to report any bugs, issues, or suggestions for improvement. You can also contact me anytime for questions or discussions.
Disclaimer
This role is provided "AS IS". I can't guarantee it will work as expected, and I am not responsible for any damage or misconfiguration it may cause. Please review the role carefully before using it.
License
MIT
Author Information
This role was created in 2020 by Thorian93.
ansible-galaxy install thorian93.php