Skip to content

amalbosemathew/nginx_wordpress_ubuntu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress Provision through Ansible Playbook.

Description:

In this guide, we’ll focus on getting a Wordpress 5.7.2 instance set up on a LEMP stack (Linux, Nginx, MySQL, and PHP7.2) on an Ubuntu 18.04 LTS server.

Features:

  • Easy to provision a wordpress site based on Nginx in Ubuntu Server.
  • Variables such as Domain name, Wordpress database name, DB user, DB password and MySQL root password is provided through the variable.vars file.

Prerequisites

  • In this scenario we have used Master server as Amazon Linux 2 and Client server as Ubuntu 18.04 LTS with desired ports 22, 80 opened.
  • Master server installed with Ansible2 (For your reference visit How to install Ansible)
Ansible Modules used:

Inventory , File, Database, Command

How to Use:

First create a directory in master server .Then, clone this Github repository nginx_wordpress_ubuntu to your master server which is pre-installed with Ansible2. Once you cloned this repository, edit your "hosts" file (Inventory file) accordingly and modify the "variables.vars" with the desired values. Also here I have used SSH private KEY based login. So I have copied the ssh private key file as "KEY_NAME.pem" in the same directory with read permission granted to the User/Owner (eg: chmod 400 KEY_NAME.pem).

Check the connection status to your client server via:

ansible -i hosts ubuntu -m ping

Once you have established the connection, then check for any syntax error in the playbook

ansible-playbook -i hosts main.yml --syntax-check

If you are good to go, then execute the ansible-playbook:

ansible-playbook -i hosts main.yml

Optional Security Feature

Here we have used the "variables.vars" file to pass the variables as a plain text, to overcome this we can encrypt the files with a password. Ansible_vault encrypts variables and files so you can protect sensitive content such as passwords or keys rather than leaving it visible as plaintext in playbooks or roles.

To encrypt a file, use the ansible-vault encrypt command.

ansible-vault encrypt main.yml hosts KEY_NAME.pem variables.vars

To prompt for the password:

ansible-playbook -i hosts --ask-vault-pass main.yml

About

Installing wordpress with ngix in Ubuntu

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published