first commit
This commit is contained in:
17
solutions/roles/phpinfo/README.md
Normal file
17
solutions/roles/phpinfo/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# phpinfo Role
|
||||
|
||||
This role installs Apache, PHP, and Firewalld, opens HTTP access, fixes SELinux
|
||||
contexts, and deploys a PHP info page.
|
||||
|
||||
## Requirements
|
||||
- RHEL / Rocky / Alma 9
|
||||
- SELinux enforcing
|
||||
- firewalld enabled
|
||||
|
||||
## Usage
|
||||
```yaml
|
||||
- hosts: web
|
||||
become: true
|
||||
roles:
|
||||
- phpinfo
|
||||
|
||||
4
solutions/roles/phpinfo/defaults/main.yml
Normal file
4
solutions/roles/phpinfo/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
phpinfo_webroot: /var/www/html
|
||||
phpinfo_file: index.php
|
||||
|
||||
6
solutions/roles/phpinfo/handlers/main.yml
Normal file
6
solutions/roles/phpinfo/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Restart httpd
|
||||
ansible.builtin.service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
|
||||
2
solutions/roles/phpinfo/meta/.galaxy_install_info
Normal file
2
solutions/roles/phpinfo/meta/.galaxy_install_info
Normal file
@@ -0,0 +1,2 @@
|
||||
install_date: 'Tue 30 Dec 2025 12:53:11 AM '
|
||||
version: ''
|
||||
22
solutions/roles/phpinfo/meta/main.yml
Normal file
22
solutions/roles/phpinfo/meta/main.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
galaxy_info:
|
||||
role_name: phpinfo
|
||||
author: lab
|
||||
description: Installs Apache, PHP, configures firewalld, fixes SELinux, and deploys a PHP info page
|
||||
license: MIT
|
||||
min_ansible_version: "2.9"
|
||||
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- "9"
|
||||
|
||||
galaxy_tags:
|
||||
- php
|
||||
- httpd
|
||||
- firewalld
|
||||
- selinux
|
||||
- web
|
||||
|
||||
dependencies: []
|
||||
|
||||
41
solutions/roles/phpinfo/tasks/main.yml
Normal file
41
solutions/roles/phpinfo/tasks/main.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Install required packages
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- httpd
|
||||
- firewalld
|
||||
- php
|
||||
state: present
|
||||
|
||||
- name: Enable and start httpd
|
||||
ansible.builtin.service:
|
||||
name: httpd
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Enable and start firewalld
|
||||
ansible.builtin.service:
|
||||
name: firewalld
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Allow HTTP traffic through firewalld (persistent and immediate)
|
||||
ansible.posix.firewalld:
|
||||
service: http
|
||||
state: enabled
|
||||
permanent: true
|
||||
immediate: true
|
||||
|
||||
- name: Fix SELinux context on webroot
|
||||
ansible.builtin.command: restorecon -Rv {{ phpinfo_webroot }}
|
||||
changed_when: false
|
||||
|
||||
- name: Deploy PHP info page
|
||||
ansible.builtin.template:
|
||||
src: index.php.j2
|
||||
dest: "{{ phpinfo_webroot }}/{{ phpinfo_file }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify: Restart httpd
|
||||
|
||||
4
solutions/roles/phpinfo/templates/index.php.j2
Normal file
4
solutions/roles/phpinfo/templates/index.php.j2
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
phpinfo();
|
||||
?>
|
||||
|
||||
2
solutions/roles/phpinfo/tests/inventory
Normal file
2
solutions/roles/phpinfo/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
solutions/roles/phpinfo/tests/test.yml
Normal file
5
solutions/roles/phpinfo/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- phpinfo
|
||||
2
solutions/roles/phpinfo/vars/main.yml
Normal file
2
solutions/roles/phpinfo/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for phpinfo
|
||||
Reference in New Issue
Block a user