Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e216057
Create LAMP.ini
Pritam1705 May 29, 2025
387b9d6
Create debian.yml
Pritam1705 May 29, 2025
f2bce4d
Create main.yml
Pritam1705 May 29, 2025
b486960
Create redhat.yml
Pritam1705 May 29, 2025
6627f5b
Create main.yml
Pritam1705 May 29, 2025
49b6121
Delete roles/lampstack/tasks/tasks directory
Pritam1705 May 29, 2025
aa0a0ac
Update main.yml
Pritam1705 May 29, 2025
27776df
Create main.yml
Pritam1705 May 29, 2025
6810a31
Create debian.yml
Pritam1705 May 29, 2025
5a72f56
Create redhat.yml
Pritam1705 May 29, 2025
cb1abcf
Create main.yml
Pritam1705 May 29, 2025
0dfafb9
Create main.yml
Pritam1705 May 29, 2025
4485cd9
Create test
Pritam1705 May 29, 2025
5cb5618
Add files via upload
Pritam1705 May 29, 2025
2537cc5
Delete static/test
Pritam1705 May 29, 2025
9022619
Create ansible.cfg
Pritam1705 May 29, 2025
0e61a89
Update README.md
Pritam1705 May 29, 2025
90645a6
Update main.yml
Pritam1705 Jul 3, 2025
36a1158
Update main.yml
Pritam1705 Jul 3, 2025
1d6e7bf
Update main.yml
Pritam1705 Jul 3, 2025
8a99384
Delete roles/lampstack/tasks/debian.yml
Pritam1705 Jul 3, 2025
2b79d09
Delete roles/lampstack/tasks/redhat.yml
Pritam1705 Jul 3, 2025
a20df0c
Create apache.yml
Pritam1705 Jul 3, 2025
6cb3ece
Create mysql.yml
Pritam1705 Jul 3, 2025
4461466
Create php.yml
Pritam1705 Jul 3, 2025
a390f56
Update main.yml
Pritam1705 Jul 10, 2025
35ca774
Update main.yml
Pritam1705 Jul 10, 2025
1cc0487
Delete roles/lampstack/meta directory
Pritam1705 Jul 10, 2025
d937955
Create main.yml
Pritam1705 Jul 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 97 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,97 @@
# lamp-stack

## Ansible Role: LAMP Stack
[LAMP stack Image](https://github.com/OT-OSM/lamp-stack/blob/LAMP/static/LAMP.png)

### Version History

|**Date**| **Version**| **Description**| **Changed By** |
|----------|---------|---------------|-----------------|
|**MAY '29'** | v.1.0 | Initial Draft | Pritam Kondapratiwar |



## Table of Content
- [Introduction](#introduction)
- [Salient Features](#salient-features)
- [Supported OS](#supported-os)
- [Directory Structure](#directory-structure)
- [Role Variables](#role-variables)
- [Inventory](#inventory)
- [References](#references)


### Introduction

**LAMP** is a group of open-source software used together to run websites and web applications. It's called a **stack** because each layer works on top of the other.

**LAMP** stands for:

- **L – Linux**: The operating system (like Windows, but open-source).
- **A – Apache**: The web server software that shows your website in browsers.
- **M – MySQL**: The database system that stores your website’s data (like users, posts, etc.).
- **P – PHP**: The programming language used to create the website logic.


### Salient Features

- **Open Source**: All components of LAMP are free and open-source, reducing software costs.
- **Cross-Platform Support**: While originally designed for Linux, LAMP can be adapted to other platforms like Windows (WAMP) and macOS (MAMP).
- **Flexible and Customizable**: Developers can modify components to suit their project needs.
- **Community Support**: Large and active community support for all LAMP components.

### Supported OS
------------
* Ubuntu 20.10 and above
* Debian 11 and above
* RHEL 8.2 and above

### Directory Structure

#### For LAMP stack
```
├── defaults
│   └── main.yml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   ├── debian.yml
│   ├── main.yml
│   └── redhat.yml
```

### Role Variables

|**Variables**| **Default Values**|
|----------|---------|
| **server url** | http://127.0.0.1 |

## Inventory

An inventory should look like this:-
#### For LAMP stack
```ini
[LAMP stack host]
13.xxx.xxx.xx ansible_user=ubuntu

```

Example Playbook
----------------

* Here is an example playbook:-
#### For LAMP stack
```sh
---
- hosts: LAMP stack host
become: yes
roles:
- lampstack

```

## References
----------
- **[software](https://www.digitalocean.com/community/tutorials/how-to-install-lamp-stack-on-ubuntu)**
17 changes: 17 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[ssh_connection]
pipelining=True
ansible_ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 -o UserKnownHostsFile=/dev/null
#control_path = ~/.ssh/ansible-%%r@%%h:%%p

[defaults]
force_valid_group_names = ignore
host_key_checking=False
gathering = smart
fact_caching = jsonfile
fact_caching_connection = /tmp
fact_caching_timeout = 86400
stdout_callback = default
display_skipped_hosts = no
callbacks_enabled = profile_tasks,ara_default
deprecation_warnings=False
roles_path = roles
2 changes: 2 additions & 0 deletions inventory/LAMP.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[lamphost]
13.xxx.xxx.xx ansible_user=ubuntu
12 changes: 12 additions & 0 deletions roles/lampstack/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apache_packages:
- apache2

mysql_packages:
- mysql-server

php_packages:
- php

apache_service: apache2
mysql_service: mysql
12 changes: 12 additions & 0 deletions roles/lampstack/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: restart apache
ansible.builtin.systemd:
name: "{{ apache_service }}"
state: restarted
enabled: true

- name: restart mysql
ansible.builtin.systemd:
name: "{{ mysql_service }}"
state: restarted
enabled: true
11 changes: 11 additions & 0 deletions roles/lampstack/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
galaxy_info:
role_name: lamp
author: OT-OSM
description: LAMP Stack Role
license: MIT
min_ansible_version: 2.9
platforms:
- name: Ubuntu
versions:
- focal
dependencies: []
17 changes: 17 additions & 0 deletions roles/lampstack/tasks/apache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: Update apt cache
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600

- name: Install Apache packages
ansible.builtin.apt:
name: "{{ apache_packages }}"
state: present

- name: Ensure Apache is started and enabled
ansible.builtin.systemd:
name: "{{ apache_service }}"
state: started
enabled: true
notify: restart apache
9 changes: 9 additions & 0 deletions roles/lampstack/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Include Apache installation
ansible.builtin.include_tasks: apache.yml

- name: Include MySQL installation
ansible.builtin.include_tasks: mysql.yml

- name: Include PHP installation
ansible.builtin.include_tasks: php.yml
12 changes: 12 additions & 0 deletions roles/lampstack/tasks/mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Install MySQL packages
ansible.builtin.apt:
name: "{{ mysql_packages }}"
state: present

- name: Ensure MySQL is started and enabled
ansible.builtin.systemd:
name: "{{ mysql_service }}"
state: started
enabled: true
notify: restart mysql
10 changes: 10 additions & 0 deletions roles/lampstack/tasks/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Update apt cache
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600

- name: Install PHP packages
ansible.builtin.apt:
name: "{{ php_packages }}"
state: present
Binary file added static/LAMP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.