Git Product home page Git Product logo

lemp-ansible's Introduction

Ansible LEMP Stack Deployment

This Ansible playbook automates the deployment of a LEMP (Linux, Nginx, MySQL, PHP, Phpmyadmin) stack on a remote server. It includes the installation and configuration of Nginx, PHP-FPM, MySQL, and phpMyAdmin.

Prerequisites

  • Ansible installed on your local machine.
  • Access to a remote server with SSH key authentication.

Inventory Configuration (inventory.yml)

all:
  hosts:
    web01:
      ansible_host: your-host
      ansible_user: your-host-username
      ansible_ssh_private_key_file: pem-file
      ansible_ssh_common_args: '-o StrictHostKeyChecking=no'

Nginx Configuration (nginx.conf.j2)

The playbook includes a customized Nginx configuration template (nginx.conf.j2) for your application. Ensure to adjust it according to your specific requirements.

Playbook (web.yml)

This playbook installs and configures the LEMP stack on the specified server.

Variables

  • php_version: PHP version to be installed (default is "8.2").
  • php_packages: List of PHP packages to be installed.

Tasks

  1. Install and configure Nginx.
  2. Add Ondřej Surý PPA repository for PHP.
  3. Install and configure PHP-FPM.
  4. Install MySQL and its dependencies.
  5. Configure MySQL, create a user, and a database.
  6. Enable remote login to MySQL.
  7. Download and install phpMyAdmin.

Handlers

  • Restart mysql: Restart MySQL service after configuration changes.
  • Restart nginx: Restart Nginx after Nginx configuration changes.
  • Update package cache: Update package cache after adding repositories.

Running the Playbook

ansible-playbook -i inventory.yml web.yml

This playbook automates the entire process of setting up a LEMP stack, ensuring a smooth deployment of your web application.

Note: Make sure to review and customize the playbook according to your specific project requirements. In the Lemp.yaml file set your DB username and password for your convenience

lemp-ansible's People

Contributors

karthigeyanbaskaran avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.